locked
Using EF Code First Approach in Production Environment RRS feed

  • Question

  • User-619898029 posted

    Hi All,

    It is very important for me to understand the realtime impact of using EF code forst approach for the development. 

    I am working on an web application, which in future will be adding more modules and functionalities as the application grows larger. For this I am planning to use MVC4 and EF codefirst approach.

    The database will be designed by me, but there will be multiple developers who will be working on the same DB.

    Its been some time that I have started to learn MVC4 and EF basics. I am trying to work around with few examples using Code first approach.

    I have learnt creating model classes, DB context , and also updating the new database changes using Code first migrations and it feels good to implement these new features and to see that it works perfect !!!.

    But what keeps me thinking and hold me back from going further is

    "How far it is appropriate to use "EF code first with migrations" to use for in our application where we have many developers who will be working on the same database for different modules. Since every one will be using code first , there are chances of clash. For example, in a scenario suppose I am working on module A and I try to update my database column by changing the existing column datatype to a new one during development phase and I use Migrations and update the database column new datatype. But the same column will be used by other developers with the old datatype. Therefore there will a clash in the column datatype and hence it might result in error in  other modules during executions. How this scenario is handled in real world development?

    Please advice me. I look forward to hearing from you.

    Your help is appreciated

    Thanks,

    mds2907

    Thursday, November 12, 2015 2:44 AM

All replies

  • User-821857111 posted

    suppose I am working on module A and I try to update my database column by changing the existing column datatype to a new one during development phase and I use Migrations and update the database column new datatype. But the same column will be used by other developers with the old datatype. Therefore there will a clash

    You would have the same issues if you manually altered the database schema. Migrations doesn't introduce any new issues in this regard. Here's some advice on working with migrations in a team environment: https://msdn.microsoft.com/en-us/data/dn481501.aspx

    Thursday, November 12, 2015 3:15 AM
  • User-619898029 posted

    Hi Mike,

    Thanks of the reply.

    I have started reading the article which you have provided a link to. before that I would like to add as below.

    In manual database changes, Since I will the in-charge of database , therefore any changes have to be informed to me to be updated. But In case of EF,  the developers can make changes to database by updating their model, adding migrations and running update-database command to make their changes. This is where I am more worried about.

    Thanks,

    mds2907

    Thursday, November 12, 2015 5:00 AM