asp.net - Repository pattern in Web Forms -


i have used repo pattern in web forms application in following way

ui layer:

it contains code behind files in controls being binded , user actions insert update etc catered for

the ui layer calls

repository layer:

it contains repository classes inheriting genericrepo:igeneric

and

data layer:

it contains ef generated domain classes

the layers strict time being ui layer calls repo layer , in turns call data layer fetch data.

problem:

now problem im facing if example need list of products on products.aspx page need thing

iproductrepo pr = new productrepo();  ilist<products> lstproducts = pr.getall(); 

i dont want add reference of data layer ui layer in order access domain entities i.e generated ef

what options? please guide me right path

regards.

in opinion you're missing layer. built this:

ui                | -----             | **domain**        |   domain classes -----             | dal (repository)  | 

this way logic in separate layer , dal hidden logic , domain model.

another way solve problem using dependency injection. way can define interfaces , keep references interfaces. dependency container can ten tie references real types.

my preferred di container example ninject


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -

matlab - How to equate a structure array to structure array -