Layered Architecture in Entity Framework 4.0

Hi I'm trying to create a small project. I plan to use 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 objects and ObjectContext through EF. I originally planned it in DataAccess. but to make entities accessible in the whole layer, I have to reference the DataAccess dll at all levels (which is not a good approach).

Can I create objects in a new Entities layer and leave the ObjectContext in DA. How well it works.

The main difference between objects and POCO? (both must be generated by EF).

Are these objects available as DataContract (Seralized) by default?

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

thank

+3
source share
3 answers

Hey, I recently looked at this article. This is what I was looking for. POCO cannot be used in WCF script. It is best to use Self tracking objects, and for this we can use t4 templates to generate code. I am idle because my question will be the objects of self-testing.

The benefits of using STE are explained in this article.

0
source

"real-world" NerdDinner 185- PDF- "how-every-line-was-written" Plex.

: http://www.nerddinner.com/

NerdDinner - . DTO AutoMapper, " ",

+2

- Data Access; , .

  • POCO , , ( , , .
  • - , , , - (int, string, bool ..). ) POCO ( ).
  • Access impementation , - EF. , EF POCOs, , .

POCO ( ) Entities?

, - - , "" ; , , .

POCO - , - - ( ). /DDD POCO ( , ).

- () -; , , , , (, DTO, ).

? , , , . Structs ( Collections) POCO, classes.

- :

  • .
  • - , , .
  • POCO , .
+2

Source: https://habr.com/ru/post/1770388/


All Articles