.netentity-frameworkarchitecturepocoentities

Layered Architecture in Entity Framework 4.0


Hi I am trying architect a small project. I planning to have Data acess, Business Service, WcfService, UI Layer.

I am trying to use EF 4.0 and MVC 2.0. My question is where to generate the entities and ObjectContext through EF. I initially planned it in DataAccess. but to make entities available across all layer I have to reference DataAccess dll across all layers (which is not a Good approach).

Can I make entities in a new layer called Entities and leave ObjectContext in DA. How well it works.

Basic difference between Entities and POCO? (both should be generated by EF).

Is these Entities are available as DataContract (Seralized) by default?

I am trying to avoid repeating the code as much as possible. let me know how will this work.

Thanks


Solution

  • Hey I recently looked at this article. This is what i was looking for. POCO's can't be used in WCF scenario. The best thing to use would be Self tracking entities and for this we can use t4 templates for code generation. I idle answer for my question would be Self tracking entities.

    The advantage of using STE is explained in this article clearly.