开发者

Entity Framework 4.0 Configuration Question

开发者 https://www.devze.com 2023-03-30 11:58 出处:网络
For the code first conventions (for example HasRequired, HasOptional, ...Dependent, ...Principal) is that meant for creating the database or enforcing your classes to have the appropriate navigation p

For the code first conventions (for example HasRequired, HasOptional, ...Dependent, ...Principal) is that meant for creating the database or enforcing your classes to have the appropriate navigation properties? I'm working with an existing database so there is alot of configu开发者_如何学Goration going on and this aspect is confusing me...

thanks


it is designed to describe what your relationships look like so that entity framework knows how to pull your data from the database in an existing database situation

if you are generating your database from code then much of this is unnecessary unless you want you database to look a certain way as entity framework has built in conventions for dealing with relationships and keys

eg collections are generally one to many relationships, single class types are generally one to one (unless overridden by defining a mapping as a complex type ) etc

0

精彩评论

暂无评论...
验证码 换一张
取 消