Validation Application Block

Dec 6, 2011 at 12:25 PM

Hi Experts,

I  have been trying to debug the Validation code sample by adding the original code of Unity (dll) which I got from code plex which has the same version as of the existing Unity dll that comes with EAB.

This new Unity dll has been added to Microsoft.Practices.EnterpriseLibrary.Common project as well as Microsoft.Practises.EnterpriseLibrary.Validation project and the latest dll's are been added to validation sample. The code was compiled successfully. but when I run the sample it has been throwing the below error while creating the ValidatorFactory. say

valFactory = EnterpriseLibraryContainer.Current.GetInstance<ValidatorFactory>() 

Inner Exception : {"Resolution of the dependency failed, type = \"Microsoft.Practices.EnterpriseLibrary.Validation.ValidatorFactory\", name = \"(none)\".\r\nException occurred while: while resolving.\r\nException is: InvalidOperationException - The type ValidatorFactory 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.Validation.ValidatorFactory,(none)\r\n"}

StackTrace: "   at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.GuardTypeIsNonPrimitive(IBuilderContext context, SelectedConstructor selectedConstructor) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\BuildPlan\\DynamicMethod\\Creation\\DynamicMethodConstructorStrategy.cs:line 289\r\n   at Microsoft.Practices.ObjectBuilder2.DynamicMethodConstructorStrategy.PreBuildUp(IBuilderContext context) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\BuildPlan\\DynamicMethod\\Creation\\DynamicMethodConstructorStrategy.cs:line 71\r\n   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\StrategyChain.cs:line 110\r\n   at Microsoft.Practices.ObjectBuilder2.DynamicMethodBuildPlanCreatorPolicy.CreatePlan(IBuilderContext context, NamedTypeBuildKey buildKey) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\BuildPlan\\DynamicMethod\\DynamicMethodBuildPlanCreatorPolicy.cs:line 48\r\n   at Microsoft.Practices.ObjectBuilder2.BuildPlanStrategy.PreBuildUp(IBuilderContext context) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\BuildPlan\\BuildPlanStrategy.cs:line 37\r\n   at Microsoft.Practices.ObjectBuilder2.StrategyChain.ExecuteBuildUp(IBuilderContext context) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\ObjectBuilder\\Strategies\\StrategyChain.cs:line 110\r\n   at Microsoft.Practices.Unity.UnityContainer.DoBuildUp(Type t, Object existing, String name, IEnumerable`1 resolverOverrides) in D:\\Projects\\TSAB\\Unity\\unity-63122\\Unity\\Unity\\Src\\UnityContainer.cs:line 512"

Please suggest me on where I am going wrong. Thanks in advance