How to match a table column with two entity properties?

Following this , I'm trying to map an IsActive table column to two different objects. is there any way to do this?

+4
source share
2 answers

It's impossible. Each column should be displayed only once, because otherwise it will lead to inconsistencies. For example, if you would set a different value for each property that you want to save? In addition, the presence of two properties that display the same field does not make sense.

+1
source

You cannot have two properties in the same object mapped to the same column.

But there are methods called "table splitting" and "object splitting", http://www.deliveron.com/blog/post/table-splitting-in-code-first-entity-framework.aspx and http: // www .deliveron.com / blog / post / Entity-Splitting-in-Code-First-Entity-Framework.aspx

This way you can have two different objects mapped to the same table.

+1
source

Source: https://habr.com/ru/post/1388593/


All Articles