开发者

Are EF4 classes really POCO?

I'm starting to study EF4 as a possible replacementt for NH in my new projects. I'm interested in an object-first developement. I found a tutorial that drive me in creating a designer surface and draw my entities here... the resulting entities are plenty of attributes ( are this POCO ? ), so what I ask is: Is there some way to use EF4 by writing the entities in code, whitout dragging and designi, plus creating and upd开发者_运维百科ating the database ? Some tutorial/blog ?


EF offers several ways to create your entities. First is simply using designer and let it generate classes for you as "code behind" of the designer. These ones are heavy entities - no POCOs. Second approach is to use designer but turn auto generation off. Instead you will use POCO T4 template which will create real POCOs for you (you can also create POCOs by yourselves but you have to follow strict rules - expecially if you want to use lazy loading). The last option is to use new Code-First approach wich is not part of EF itself - it is in CTP5 currently. This approach let you define POCO classes and use fluent API or attributes to map them.


There's a fairly comprehensive tutorial on Julie Lerman's blog about EF4 and POCO classes. It may have what you're looking for.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜