Enterprise Library in N-Tier Applications

Topics: Data Access Application Block, Exception Handling Application Block, Logging Application Block
Apr 29, 2010 at 7:37 PM

We want to write an independent Data Access Layer for our projects, using Data Access Application Block.

Our Data Access Layer consists of a project of type "Class Library", which services we want to expose through a web service to be consumed by a variety of client applications.

But the Data Access Application Block doesn't recognize the configuration file that we previously added to the Class Library Project.

We are facing similar issues when trying to implement use of Exception Handling Application Block to manage data access exceptions.


Our question is, which is the best approach to use Enterprise Library in N-Tier applications, this is, applications which components are physically separated in different computers?

How can we configure Application Blocks in Class Library Projects?

Is there any sample application that demonstrates use of Enterprise Library in such scenarios?


We would appreciate any help.

Thank you.

Apr 30, 2010 at 2:09 AM

Class libraries don't own configuration files.  Configuration file should be placed in an executable project (console, windows, web, webservice).  In your case, you could put the configurations you want in the web service.  But if you reallly want to specify a certain config file, you can make use of a FileConfigurationSource.  See Tom Hollander's blog on this - http://blogs.msdn.com/tomholl/archive/2006/04/02/entlib2externalconfig.aspx


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.