Multi layered architecture using Entity Framework 4 and Repository Pattern -


i have build architecture of web application using entity framework 4.1 , asp.net. have database structure, have use database-fist. have read lots of articles , threads here, seems i'm missing something. have decided organize projects in following way:

i have architecuted web app linq2sql. used this project. provides t4 template generates specific static repository class each entity. approach easy add additional logic repository, such getuserbyname(). approach cannot find similar approach ef4 far. have found generic repositories , have manually create concrete repositories. don't in case first have application i'm working on has bit complex business logic, have manually create concrete repositories each entity. second, if @ first use generic repository entities, , later need use, example getuserbyname(), there inconsistency in code. prefer data retreiving done same way.

i either missing in architecte structure.

  • generic: generic repository if neccessary seperated

  • dal: edmx (entity model) file context class , repositories

  • bll: business logic of system

    -- entities

    -- services

    -- etc

  • ui: asp.net pages

questions:

  1. is separation of logic correct?

  2. should use specific repositories?

  3. what implementation of repository pattern recommend best project organization , easiness use?

  4. is better use static repository?

thanks

don't use static classes repository. awful , far away correct object oriented design. blocks possibility of inversion of control , dependency injection.

if want use repository pattern must use specific repository. generic repository wrapper around ef related classes (where objectset / dbset ef dependent repository). should build repository on top of aggregate roots not on top of every entity.


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -