Entity Framework and Code First Development RRS feed

  • Question

  • Microsoft releases Entity Framework 4.0 and in it developers can do Code First Development. This is fine and thanks to Microsoft.

    I have one confution about code first development. I have worked on Entity Framework in ASP.NET 3.5 SP1 and Visual Studio 2008 SP1. In that we create a database schema and from that we create Entity Data Model. That means we are creating our class model from database. I think this is called data first development.

    But when we create Entity Data Model in Entity Framework 3.5 SP1 then there are two options. First is Generate from existing database and another is create a blank model. Suppose I create a blank model and then map it to the database. So we first develop the class models without thinking the database schema and then map it with database. My confution is, is it called code first deveopment? Then why the community people and books are saying that 'It is not possible to impliment code first development in Entity Framework 3.5 SP1'?

    To solve my confution I need your help. So please give reply on this post.

    Thank you.

    • Moved by Paul Zhou Wednesday, November 30, 2011 5:35 AM move for better support (From:.NET Platform Architecture Development Discussions)
    Tuesday, November 29, 2011 8:54 AM


All replies

  • I'm moving this thread to ADO.NET Entity Framework and LINQ to Entities forum to get better support.

    Have a nice day.

    Paul Zhou [MSFT]
    MSDN Community Support | Feedback to us
    Wednesday, November 30, 2011 5:34 AM
  • Hi Arnab,

    I think you can refer this link: http://blogs.msdn.com/b/adonet/archive/2011/03/07/when-is-code-first-not-code-first.aspx for code first.

    >>'It is not possible to impliment code first development in Entity Framework 3.5 SP1'

     the answer is no, you should install EF4.1 first here: http://blogs.msdn.com/b/adonet/archive/2011/03/15/ef-4-1-code-first-walkthrough.aspx

    Have a nice day.

    Alan Chen[MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by Alan_chen Friday, December 9, 2011 7:41 AM
    Wednesday, November 30, 2011 9:19 AM
  • Hi Arnab,

                  Whatever you are saying is Model first development.In both Data first development(in this - you start with the Database) and Model first Development (in this - you start with the Model) you need to do some configuration stuffs(e.g changes needs to be done in the mapping file whenever the entities changes).In case of Code first Development also, you start with the model but you don't need to do any configuration changes in general - this is "convention over configuration" - means conventionallly whatever has been done for ages those are already configured in the EF Framework and these conventions(some default settings) can be used in general (to dynamically build the Database and related tables).But you can override these default conventions by overriding (in a Fluent Interface way).

                  Hope, I was able to make you understand the basics.



    Wednesday, April 25, 2012 6:21 AM