1

This is a very simple question...

I have reverse engineered an existing database with entity framework core, it works well and I have my classes defined, it has also created on the OnModelCreating event thousands and thousands of line of code detailing all the indexes references etc...

Do I need this code? I am not planning to modify the db schema just simply reading data and updating data from an api, can I comment out all of these lines?

1 Answer 1

0

You mean protected override void OnModelCreating(ModelBuilder modelBuilder) method in you DbContext class?

Yes, you need it.

It contains description of references between your entities - it's important for EF to build correct SQL queries.

It is possible to optimize/minimize it (by removing some lines that do not important for your area), but it's manual operation, if you have enough time...

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.