I have the following model:
public class Some开发者_Go百科Object1 {
public virtual Guid Id {get; set; }
public string Property1 {get; set; }
}
public class SomeObject2 {
public virtual Guid Id {get; set; }
public string Property2 {get; set;}
}
and the table
SOME_OBJECTS
PK_SOME_OBJECTS Guid
WHICH_OBJECT Integer
PROPERTY1 varchar2
PROPERTY2 varchar2
when the WHICH_OBJECT column = 1
the row contains information for SomeObject1
, when the WHICH_OBJECT column = 2
the row contains information for SomeObject2
.
How would I go about doing these mappings? I've found the discriminator feature but it seems to only apply when you have subclasses in an inheritance hierarchy.
I'm pretty sure it's not possible to map two unrelated entities to the same table; however, you may be able to map them to two different views that reference the same table.
精彩评论