.net - Entity Framework - GetObjectByKey don't allow the primary key -


i'm trying record using getobjectbykey function this:

enumerable<keyvaluepair<string, object>> entitykeyvalues =                 new keyvaluepair<string, object>[] {                  new keyvaluepair<string, object>("journalid",                                     new guid("6491305f-91d9-4002-8c47-8ad1a870cb11")) };  entitykey key = new system.data.entitykey(string.format("{0}.{1}", objectcontextmanager.current.defaultcontainername, "journal"), entitykeyvalues); 

but exception

system.argumentexception: provided list of key-value pairs contains incorrect number of entries. there 54 key fields defined on type 'namespace.journal', 1 provided. parameter name: key

the type journal view.

how can use function 1 field, reason why need because don't want specify generic type , 1 given entity set name.

thanks in advance

view in database doesn't have key ef needs when insert view model ef take non-nullable, non-binary columns , defines them key - @ moment key consists of 54 columns. solution manually modifying edmx file (as xml) default edmx designer changes deleted after each update database.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -