Implement LightInject WCF into a WCF web Service

609 views Asked by At

I am trying to implement LightInject into my WCF service.

I have the LightInject.Wcf class file from GitHub but i have no clue on how to use it in my service.

Please help

2

There are 2 answers

1
W van Noort On BEST ANSWER

I just run into the same problem. I had already noticed the post you are referring to, but i assumed there must be an easier way. By inspecting the code i found an alternative:

Make sure you get the latest version of LightInject.Web and LightInject.Wcf. Just as a regular MVC application you can setup things in the global.asax:

protected void Application_Start(object sender, EventArgs e)
{
        var container = new ServiceContainer();           
        container.Register<ILogger, Log4netLogger>();
        container.EnableWcf();

}

After this, configure the services as you would normally do without LightInject.

0
WildBosnian On

I have found this after lots of searching http://www.ienablemuch.com/2014/10/wcf-lightinject-nhibernate-part-1-of-2.html

a step by step guide to setting this up, which is what I was after.