I'm using ninject (extensions) to inject dependencies in a wcf service. What scope must I use for injecting IDataContext
dependency since I get "The context cannot be used while the model is being created." error when using InRequestScope()
?
Bind<IDataContext>().To<DataContext>().InRequestScope()
.WithConstructorArgument("connectionString", "TestDB");
Check this out. I found it very helpful getting DI working with Ninject with WCF Service. It's a very basic example with minimal code to get you going.