Relationships Does EDMX only affect performance?

Asked

Viewed 54 times

6

I have a question about the Entity Framework.

Here at the company where I work, the tables are generated in the bank without any relationship, until the fields are created that will be foreign keys but, the whole relationship is done by EDMX in the Entity Framework.

The version we just migrated is 5 and the database is Mysql.

From what I read, Mysql creates the index but for that it needs the FK, and as we just create the tables without relating anything, I think it will make the system heavier.

1 answer

2


That’s it much wrong the way you use it. Entity Framework without foreign keys makes no sense from any point of view.

Answering your question, yes, and much.

If there are no foreign keys, there are no indexes. If there are no indexes, the execution plan will use TABLE SCANS to get the information, and the performance will be a disaster, especially considering Lazy Load (lazy load), which is one of the tonics of the Entity Framework.

Working with the Entity Framework assumes relationships specified in Model, and this is where the information about tables, your private and foreign keys is extracted.

It is important to say that the EDMX model is outdated and should be discontinued as soon as possible. Recommended is the use of Migrations. In this reply I run a complete script configuration, considering that all of its Models were removed from the EDMX and converted into classes. To separate the classes, use this article.

  • Thank you very much. Your answer has helped me a lot!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.