0

Suppose I have the class

public class Parent {
    virtual string Name {get; set;}
}

public partial class Child : Parent {
}

When I use EF DB first, it generates the following:

public partial class Child {
    string Name {get; set;}
}

How do I get it to use the 'override' keyword for Name? I don't want to add that every time I update the DB.

Husain
  • 784
  • 1
  • 9
  • 22

1 Answers1

0

If you want to create you model using inheritance check those links:

Entity Framework DB-First, implement inheritance

http://www.asp.net/mvc/overview/getting-started/getting-started-with-ef-using-mvc/implementing-inheritance-with-the-entity-framework-in-an-asp-net-mvc-application

if you want to create new properties that is not in your db to an existing class in your model, try use partial classes: https://msdn.microsoft.com/pt-br/library/wa80x488.aspx

Community
  • 1
  • 1