I have done scaffolding of my SQLServer database. And it creates the POCO objects in the specified folder. What i would like to do is that it extends from my base class. I also use repository pattern so i need to have Id key on every entity and I don't want to change that each time i rescaffold the database.
Scaffold Model Example
public partial class Food
{
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public double Price { get; set; }
}
Expected Result:
public partial class Food : EntityBase
{
public string Name { get; set; }
public string Description { get; set; }
public double Price { get; set; }
}
public class EntityBase : IEntityBase
{
public int Id { get; set; }
}
See Question&Answers more detail:os