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.

1
  • Use code first from database, designer from database leaves you with little to no flexibility Commented Jan 22, 2016 at 8:56

1 Answer 1

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.