Not so long ago, I used the DataBase First approach with edmx models. I created partial classes to extend the functionality of domain models created by edmx.
public partial class DomainObject
{
public int PropertyA {get; set;}
public int PropertyB {get; set;}
}
public partial class DomainObject: IDomainEntity
{
public int EntityId {get; set;}
public int EntityTypeId {get; set;}
public int DoSomethingWithCurrentEntity()
{
return 0;
}
}
All particles implemented the IDomainEntity interface
public interface IDomainEntity
{
int EntityId {get; set;}
int EntityTypeId {get; set;}
int DoSomethingWithCurrentEntity();
}
Thus, all the properties of this interface were not mapped to tables in the DataBase.
Now I move on to the Code First approach, and all these properties are trying to map to DataBase. Of course, I could use the [NotMapped] attribute, but the number of properties in the interface and classes is huge (over 300) and continues to grow further. Is there any approach to ignore all properties from a partial or interface for all classes at once.
source
share