c# - How to have multiple entities mapped against one table? -


i'm trying use 2 different entities against same table. purpose of having 2 entities limit amount of attributes in 1 of them, because on 1 of edit forms should possible change few of attributes.

so in order avoid having have non-editable attributes hidden preserve values, thought having separate entity portion of attributes idea.

so have 1 entity attributes, , 1 of attributes. problem exception:

`the entity types 'applicationmapping' , 'applicationmappingfull' cannot share table 'applicationmapping' because not in same type hierarchy or not have valid 1 one foreign key relationship matching primary keys between them.

the entity config classes this:

class applicationmappingfullconfiguration : entitytypeconfiguration<applicationmappingfull>   {     public applicationmappingfullconfiguration()     {       totable("applicationmapping");       haskey(p => p.id);     }   }    class applicationmappingconfiguration : entitytypeconfiguration<applicationmapping>   {     public applicationmappingconfiguration()     {       totable("applicationmapping");       haskey(p => p.id);     }   } 

how can achieve i'm trying do? there better/simpler way of doing it?

thanks!

i recommend having single entity mapped table, create 2 'view' entities contain properties form requires.

these view entities contain methods map data entered underlying entity.


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -