c# - Entity Framework 6.1 to attach object based on unique constraint other than the primary key -


i'm working on developing model comunicate jet.com api, , got across hardship entity framework common while developing ef data model data api.

so jet.com api returning unique keys in cases, don't want use keys primary keys in database few different reasons, have abillaty in entity framework implement unique constraints, question if there's way implement kind of override on attetch method attech entity based on unique key when primary key not set or not found?

i'd assume can write extension method handle this, don't want re-invent wheel...

i thinking possibility implement kind of exception handler unique key violation, far didn't figure out totally...

i'm not sure if looking for, can map primary keys in ef6+ through code:

modelbuilder.entity<officeassignment>().haskey(t => t.instructorid); 

https://msdn.microsoft.com/en-us/data/jj591617.aspx#1.1


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -