Relationships Does EDMX only affect performance?

6

I have a question about the Entity Framework.

Here in the company where I work, the tables are generated in the database without any relationship, until the fields that will be foreign keys are created, 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 indexes but for this it needs the FK, and since we just create the tables without relating anything, I think this will make the system heavier.

    
asked by anonymous 29.05.2015 / 15:02

1 answer

2

Wrong is the way you use it. Entity Framework without foreign keys does not make any sense from any point of view .

Answering your question, yes, and a lot .

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

Working with the Entity Framework supposes relationships specified in Model , and this is where you extract information about tables, their private and foreign keys.

It is important to say that the EDMX model is out of date and should be discontinued as soon as possible. It is recommended to use Migrations . In this answer I execute a complete script configuration, considering that all your Models have been removed from EDMX and converted into classes . To separate classes, use this article .

    
29.05.2015 / 21:56