Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all articles
Browse latest Browse all 8156

Microsoft.Practices.Unity configuration issue - System.TypeInitializationException

$
0
0

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?



Viewing all articles
Browse latest Browse all 8156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>