Hanging when I execute EnterpriseLibraryContainer.Current.GetInstance<Database>(ConnectionStringName);

Topics: Data Access Application Block, Enterprise Library Core
Nov 13, 2014 at 11:53 AM

Is there any reason why this code would cause hanging?

The bad news is that is does not happen every time.

I would like to know what happens under the hood when this line is executed and that may help me find an answer.

Nov 13, 2014 at 1:37 PM
You can download the Enterprise Library 5 source code from the Download Center: http://www.microsoft.com/en-us/download/details.aspx?id=15104

Not sure if this is the issue but trying to retrieve objects from the container while (concurrently) performing a re-configuration of the container could definitely cause issues. In that case, you should ensure that GetInstance waits until the re-configuration is complete. Usually bootstrapping of the container is performed once at startup before the application processes requests.

Randy Levy
Enterprise Library support engineer
Support How-to