Any Fluent API tutorials that use EF Database-First approach to explain the subject?

后端 未结 3 1859
逝去的感伤
逝去的感伤 2021-02-06 10:51

There are many tutorials on Fluent API, but they all explain it using Entity Framework Code-First code examples. Since I don\'t know Code-First, do you know of any Fluent API tu

3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-06 11:38

    There is an interesting post about accomplishing some of the “Database-First” objectives without employing the actual “Database-First” methodology per se.

    http://agilenet.wordpress.com/2011/04/11/entity-framework-4-1-rc-with-an-existing-database/

    The author uses “Code-First” and “Fluent API”, but disables the auto-generation and seeding of databases and tables.

    He shares a sample that shows “how to create an entity model, then manually create your database and then map those entities to your database. Finally it shows using the DatabaseContext to save and retrieve entities”.

    The part where he creates a “configuration class for each entity which maps between the entity and the database” is pretty cool. That step replaces the “edmx” files that would be generated when employing a formal “Database-First” approach.

提交回复
热议问题