The problem is that I have to define the entities connection string in my UI's web.config/app.config otherwise I get a runtime exception. IS defining the entities connectionstring in UI spoils the layers' distinction? Or is it accesptible in a muli layered architecture.

Should I take any additional steps to perform chage tracking, lazy loading, etc (by etc I mean the features that Entity Framework covers in a conventional, 1 project, non POCO code generation)?

Thanks for noting the repositories should be in DAL. Makes sense to implement DDD pattern. But if I want to implement business logic in repositories, does it makes sense to have reps in BLL? Do you suggest it at all? Or should I only implement basic CRUD operations in repositories?
–
KamyarJan 6 '11 at 5:52

2

No. There should be no business in the repository/DAL. If you want to apply business logic to queries, you've got a couple of options. 1) Make your repository methods business-specific: e.g List<Order> GetOrdersForACustomer(int customerId). Or 2) IQueryable repository. More difficult/risky. e.g IQueryable<Order> FindOrders(). The BLL then calls this method and performs business logic (deferred exec). For now, i'd stick with Option 1.
–
RPM1984Jan 6 '11 at 5:56

1

Very very informative. Thank you. I now have a better understanding of repository pattern/layers distinction thanks to you.
–
KamyarJan 6 '11 at 5:59

2) Dont see a problem with the connection string being in your UI app.config. Has to be defined someplace. You could copy your DAL.config to your application BIN folder that likely had the connection string created in it when you created the project but that to me would not seem right. I would personally manage it in your UI layer app.config

The problem is that I have to define
the entities connection string in my
UI's web.config/app.config otherwise I
get a runtime exception.

The connection string is always picked up from the app.config/web.config of the executing appDomain (here your asp.net app and not the DAL).
So wat you can do is create a xml file for storing settings in your DAL project and read those settings using xml classses provided by dot net framework