views:

164

answers:

4

I have a 3-tier .NET 2.0 app. The presentation layer references the middle tier. The middle tier references the database layer. For some reason, when I compile, the dll's for the data layer appear in the bin of the presentation layer. How do I stop this?

A: 

set Copy Local to false in Reference properties

epitka
This won't work once you need to deploy the application.
Andrew Hare
True, but he was just asking how to stop it.
epitka
+1  A: 

The only way to stop this is to make one or more of your tiers a service-layer (or something similar) to physically separate your tiers.

Since your separate tiers were compiled against each other the assemblies need to be there for the entire application to function properly. How do you envision the application working without all the assemblies?

Andrew Hare
A: 

It is OK to be copied because there are known as Dependencies. Your Middle tier depends on DataAccess and UI on Middle tier. You have to keep track only not to reference data access from UI.

ruslander
A: 

Normally I do physical layer application as following:

  1. UI
  2. Presenter
  3. BusinessLogic
  4. DataAccess
  5. Entity

But I'm changing my view on this organization. As I have done lot of projects and some of them demands maintenance and improvements. I start to think that this organization is too monolithic. Some authors like Ted Faison, Tomas Erl, Robert C. Martin, Andy Aunt says that this hierarchal approach is kind of naive.

Anyway... Put your logic in separated projects and build them as distincted assemblies. Make hierarchal references and you'll have what you want.

Eduardo Xavier