Fluctuating behavior of EnterpriseLibrary (EL)

Oct 28, 2010 at 3:12 PM
Code:
	Database db1 = DatabaseFactory.CreateDatabase("Demo1");

"Demo1" is name of the Connection String which was working fine before 2 days and now its started giving me error that-

"Activation error occured while trying to get instance of type Database, key "Demo1" " 

Error Details: 

Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Data.Database\", name = \"Demo1\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type Database cannot be constructed. You must configure the container to supply this value.\r\n-----------------------------------------------\r\nAt the time of the exception, the container was:\r\n\r\n  Resolving Microsoft.Practices.EnterpriseLibrary.Data.Database,Demo1\r\n"
       Source="Microsoft.Practices.Unity"
       NameRequested="Demo1"
       TypeRequested="Database"
       StackTrace:at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)
            at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, String name, IEnumerable`1 resolverOverrides)
            at Microsoft.Practices.Unity.UnityContainer.Resolve(Type t, String name, ResolverOverride[] resolverOverrides)
            at Microsoft.Practices.Unity.UnityServiceLocator.DoGetInstance(Type serviceType, String key)
            at Microsoft.Practices.ServiceLocation.ServiceLocatorImplBase.GetInstance(Type serviceType, String key)
       InnerException: System.InvalidOperationException
            Message="The type Database cannot be constructed. You must configure the container to supply this value."
            Source="Microsoft.Practices.Unity"
            StackTrace:
                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor)
                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context)
                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
                 at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey)
                 at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context)
                 at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context)
                 at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides)

I tried repairing EL on my machine. And I redeployed the EL assemblies. But problem perists.

I dont know the implementation of EL. 

So, Please Help on this. I am in a big trouble.

Thanks in Advance....

 

 

Oct 28, 2010 at 9:24 PM

This isn't a Unity specific question, could you please take it over to the Entlib forum instead (http://entlib.codeplex.com)?