Specifying connectionString as value for <parameter> value in the Microsoft Unity Block

Topics: Building and extending application blocks, Enterprise Library Core
Feb 6, 2010 at 2:51 PM


I am designing an configuration file for Unity App block and I am specifying the parameter details for the constructor injection. The parameter name of the constructor is connectionString and I want to pass the connectionString specified in the Web.config file by specifying the key name.

When I pass the key name of the connectionString to parameter value it literally takes the key name as string however i want to have the connectionString specified for that key.

Is there any way to achieve the above requirement?



Feb 8, 2010 at 1:54 AM

You can implement something like what's posted here - http://unity.codeplex.com/Thread/View.aspx?ThreadId=55758.  but what do you need the name of the connectionstring for? Are you creating an instance of a Database object?  Coz if yes, I think you can handle it by just using the DatabaseAccessBlockExtension. 

By the way, please post further questions on this and other Unity questions in the Unity forum - http://www.codeplex.com/unity/Thread/List.aspx


Sarah Urmeneta
Global Technology and Solutions
Avanade, Inc.