entity framework - Getting POCO classes in DbContext Generator -


are classes generated dbcontext generator in ef4.1 considered poco , persistence ignorant?

if so, why getting error: "the entity or complex type '' cannot constructed in linq entities query."?

this code:

return searchparam = p in ent.partnerprofiles                   select new partnerprofile                   {                        partnername =  p.partnername                   }.tolist(); 

yes can consider them pocos , persistence ignorant, because haven't got wiring notifying , tracking changes classes objectcontext generator have.

that said, there conditions ef requires lazy loading enabled (virtual navigation properties) , in persistent ignorant classes won't find primitive primary or foreign key properties. latter not required, convenient @ times (see foreign key associations).

the error design. reason not documented (as far know) has fact ef wants track entities has created itself, not ones generate in projection. many ef users difference not obvious. described more detail here.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -