-
Notifications
You must be signed in to change notification settings - Fork 7
Using Ninject with REstate
Ovan Crone edited this page Apr 11, 2018
·
2 revisions
The adapter is available in a nuget package: REstate.IoC.Ninject
var yourNinjectKernel = new StanardKernel(); // Replace with your kernel.
var restateNinjectContainer = new NinjectComponentContainer(yourNinjectKernel);
At application startup, add the following line, building on the last snippet.
REstateHost.UseContainer(restateNinjectContainer);
Some scenarios don't lend well to using a shared instance of REstateHost
, such as if you have scoped kernels, or if you plan to inject REstateHost
as a dependency. This is also supported and is honestly even easier.
Whenever you need a host, just instantiate it with the REstate Container you made before.
var host = new REstateHost(restateNinjectContainer);