문제

I recently used Dependency Injection pattern with Autofac as the IoC Container.

Normally, I would use it inside core application (Winform, WCF, WPF etc).

Currently I'm learning to create a class library project as a framework for my peer developers, and I tend to stick with the DI pattern since it allows me to unit test as I go.

How do I configure the IoC Container in a class library project without an entry point?

Should I just make something like :

public static void ConfigureLibrary() {
     //.. Do bootstraping here
}

and let core application to call it when the core app start?

How did libraries like the Patterns & Practices Enterprise Library or Spring.Net configured?

도움이 되었습니까?

해결책

How did libraries like the Patterns & Practices Enterprise Library or Spring.Net configured?

Here is an interesting article from Chris Tavares about the subject.

다른 팁

How do I configure the IoC Container in a class library project without an entry point?

Generally the application should be the root for your service registrations. But yes, one may provide default-registrations in a library. Here is a blog-post I did some days ago how I and my team currently do.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top