Hi to all,
I have implement the Microsoft unity application block in one of my project.
Project's Unity configuration file is:
<UnityConfiguration xmlns="http://schemas.microsoft.com/practices/2010/unity"><container><register type="IInputAdapterPoc" mapTo="InputAdapterPoc" /></container><alias alias="IInputAdapterPoc" type="Company.Product.Pocc.IInputAdapterPoc,Company.Product.Pocc" /><alias alias="InputAdapterPoc" type="Company.Product.Pocc.InputAdapterPocc,Company.Product.Pocc" /></UnityConfiguration>
Project's Interface and concreate class:
namespace Company.Product.Pocc { public class InputAdapterPoc : BaseInputAdapter, IInputAdapterPoc { public override void Process(Connector _connector) { } public override void Intialize(Entity _entity) { } } } namespace Company.Product.Pocc { public interface IInputAdapterPoc : IInputAdapter { } } namespace Company.Product.Interface { public interface IInputAdapter : IAdapter { void Process(Connector connect); } } namespace Company.Product.Adapter { public abstract class BaseInputAdapter : IInputAdapter { public abstract void Process(Connector connect); public abstract void Intialize(Entity entityMapping); } }Problem is - while executing the code:
var instance = new UnityContainer().Resolve<AnyType>();
it throws the Exception:
Exception Type:
System.TypeInitializationException
InnerException:
{"The type name or alias IInputAdapterPocc could not be resolved. Please check your configuration file and verify this type name."}
Message:
The type initializer for 'Company.Product.Utility.UnityHelper' threw an exception.
How can i resolve this? any idea?