-
Notifications
You must be signed in to change notification settings - Fork 531
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inject IConfiguration and IOptions in ASP.Net Core 2.0 via Ninject #270
Comments
hi, Im looking for the same information. |
Ok, I have got the IOptions working with strongly typed class and Injecting in to Controllers. I followed what mentioned in this blog, setting up Ninject in .net core. now my app settings.json looks like
Create a strongly typed class AppConfigOptions.cs, This class implements IOptions interface and returns Value.
Now we bind the above class in NinjectWebCommon.cs
That's all done binding now. Lets make use of it.
Hope this helps others. |
I am unable to identify the Type for configProvider in the below snippet var appConfiguration = configProvider.GetSection("AppConfiguration").Get(); Could you please explain that? |
It's |
I want to read out my appsettings.json file to use it in different layers of my application via Ninject DI. However, I can't seem to find any way to bind the IConfiguration or the IOptions class. All the information I find online is about the build in core DI system but nothing about Ninject. I always get a Ninject.ActivationException. Could anyone share how they did this if this is possible?
The text was updated successfully, but these errors were encountered: