Modeling with Code First so you can change databases

5

If I generate my database for MySQL using the concept of Code First can I change it to SQL Server in the future? Do you need to change the classes or just the config and provider ?

    
asked by anonymous 17.04.2017 / 15:27

1 answer

5

The idea of the Entity Framework is this, you develop independently of the database. It has even a few facilities to do the migration.

This is not to say that any code you make will be well changed without major problems. At basics the transition should be smooth. If you start doing very custom operations using very specific things from a database that can not be easily reproduced by another database there may have performance problems or even work as expected.

In general the model does not need to be changed at all, but may need some adaptation. A very good index in one database may not be as suitable in another. The physical structure in one DB may not be optimal in another. It does not mean it will not work, but adaptations will help. Queries and manipulations may require more adaptations to keep everything in order.

The provider quality of the database for the Entity Framework can make a difference.

    
17.04.2017 / 15:36