Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old October 11th, 2007, 02:43 PM
Authorized User
 
Join Date: Jan 2007
Location: , , United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default Reference Problems

Hi,

I am working on a project where I have created three projects (dll's) i.e. one for DAL, one for BLL, and one for UI.

BLL reference DAL
UI reference BLL

The trouble is that in UI when I add reference to BLL dll it also adds DAL project's dll. This way UI developer can use DAL classes as well. Am I missing something here?

Help will be much appreciated as I am stuck with this for quite sometime now.

Many thanks

Tahir

  #2 (permalink)  
Old October 12th, 2007, 09:00 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

When you say "it also adds DAL project's dll", what do you mean? Do you mean that the actual DLL files get copied into the UI project bin folder?

If your UI is using the BLL assembly's classes, and the BLL is using the DAL assembly's classes, then how do you expect the BLL to use the DAL without the class assembly present in the bin folder?

-Peter
  #3 (permalink)  
Old October 12th, 2007, 09:04 AM
Authorized User
 
Join Date: Jan 2007
Location: , , United Kingdom.
Posts: 54
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Peter,

Yes the dll's are copied in bin folder.

What you say makes sense, I was just wondering whether there is something wrong with my setup but I guess there isn't.

The only thing that bothers me is that from UI we can then use DAL classes. How can we avoid that?

Tahir

  #4 (permalink)  
Old October 12th, 2007, 09:29 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

If you consume the classes directly in the application there is no way to avoid having the data/business assemblies living with the application assemblies. As such, there is no way to prevent a developer from referencing those other binaries and consume classes from them.

It really comes down to developer practice. You have to establish the culture of the development architecture with the developers. They must know that they only build UI against BLL libraries. Yes, the binaries for the DAL are there, they have to be, and you can't programmatically hide them. The developers just have to know to not consume them directly.

Now, all this isn't to say you can not architect a system that hides your layers. If you architect your system to be service oriented you can isolate the layers. For example, you could build a business layer application. This could be a windows service or web service that exposes the business model thru the service interfaces (remoting, web services, etc). The UI applications can talk to the business layer thru the services instead of directly consuming the business classes. This can be done with the database layer as well.

Designs like this are how large enterprise systems like SAP are built. They have a database server, a database application, a business application and the client applications (and certainly additional levels in between). These are all different program processes. The client apps do not connect directly to the database server. Instead they connect to the application servers through remote procedure calls (like remoting). (In reality the client app is really a thin client or dumb terminal. All the work of the application is actually done by the application server.)

Making the jump to this type of architecture is very difficult. It requires very solid architecture and very good practices of logging and error management in order to minimize debugging problems. For lightweight applications it's far too complex and just plain overkill. It is a very cool concept though.

-Peter


Similar Threads
Thread Thread Starter Forum Replies Last Post
get reference name demac43 Excel VBA 2 November 20th, 2006 02:35 PM
2 problems: reference to scrrun.dll / worksheets fifijr Excel VBA 1 November 13th, 2006 06:48 AM
Reference Problems Morrislgn .NET Framework 2.0 0 February 17th, 2006 11:51 AM
Problems in ViewStates[]. Null Reference? chenzw BOOK: ASP.NET Website Programming Problem-Design-Solution 0 April 6th, 2004 08:01 PM
Problems with a reference darkdog VB Components 1 June 29th, 2003 03:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.