Code First from Existing Database
I've searched through SO on Code First from Existing Database
, watched this video, and read this blog. I certainly understand how to generate the POCOs and Context using this method, but I'm not understanding the 'why'.
I prefer to build the database in SSMS, and have been happy using the ADO.NET Entity Data Model
to generate the .edmx that houses my context. The Code First from Database
classes look pretty much the same, with some validation attributes added, and you get access to the modelBuilder.
I have no intention of altering the database structure via code. Are the only benefits you get with this approach the ability to add custom validation, and manipulate how your models are built? Is there an ideal scenario when you'd want to use Code First from Database
?
上一篇: EF“Model First”:在edmx和db中创建实体
下一篇: 先从现有数据库中获得代码