I want to have a Person object in my model. There is no corresponding table and no discriminator. I just want this to be a common base class for sharing with other objects (I want to define public partial class Personwith common functionality.
So, for example, I want to have:
public partial abstract class Person
{
public int Id {get; set;}
public string FirstName {get; set;}
public string LastName {get; set;}
public string DisplayName { get { return string.Format("{0}, {1}", LastName, FirstName); } }
}
public partial class User : Person
{
}
public partial class Contact : Person
{
}
So, I created an abstract entity Person, defined it as a base class for User and Contact objects, then added my properties and set my mappings for dbo.Users and dbo.Contacts for the PK identifier, FirstName and LastName Property.
I get an error message:
3032: Problem in mapping fragments starting at lines 2109
..... are being mapped to the same rows in table .... Mapping conditions can be used to distinguish the rows that these types are mapped to.
How can I make this work?
source
share