Dependency Injection
Hi,
I am planning to use Dependency Injection in Sitefinity Project. Does Sitefinity natively support DI? Is there any particular framework you recommend to use with Sitefinity? I want to have some guidance on what frameworks and how to use DI inside sitefinity.
Thank you so much.
--
Preetham Reddy
Hi Preetham,
You can use ObjectFactory class - represents a static factory class for creating application objects and we have an internal method RegisterIoCTypes which is called inside Container property of type IUnityContainer which defines the behavior of the dependency injection container. So, we use IUnityContainer and Interface Injection.
Inside Application_Start event of Global.asax you can registers types with IoC framework.
You can take a look at
Inject Some Life into Your Applications—Getting to Know the Unity
Unity DI
Documentation on codeplex
All the best,
Ivan Dimitrov
the Telerik team