开发者

How do I verify my EF4 Code-Only mappings?

In NHibernate, there is a method doing something like ThisOrThat.VeryfyMappings() (I don开发者_开发百科't know the exact definition of it since it was a while ago I last tried NHibernate...)

I recall seeing a blog post somewhere where the author showed how to do some similar testing in Entity Framework 4, but now I cant find it. So, how do I test my EF4 Code-Only mappings?


You should be able to apply the same approach as described in this blog post. It describes how to do this for Fluent NHibernate, but it should be pretty much the same for EF4.

You'll need to implement the Validate(The)Mappings method yourself, and regardless of whether you use the repository approach or go directly through the context the basic idea is the same: insert an object and retrieve it using a second repository/context to verify that all fields have been correctly transferred. Additional checks will be needed to verify references.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜