Base solution for your next web application
Open Closed

appsettings.json #2314


User avatar
0
cangunaydin created

Hello, I want to apply a new custom settings to asp.net core & angular2 application. This will be a json object value all over the application. But i want to change it from appsettings file. My problem is i tried to add this value to appsettings.json file and I can reach the value from mvc application from IHostingEnvironment interface in startup and can reach the whole config file. But how can i reach these values from applicationservice project. I have tried couple of things like SettingManager and ISettingStore but these are custom values that is parsed to a different object from the config file i guess. Can you suggest some solution for it or should i parse this value in AppSettingProvider?


2 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can do it like we do in WebUrlService here <a class="postlink" href="https://github.com/aspnetzero/aspnet-zero-core/blob/c2f52042bd74e1d29674b33f4a75dde944441fd2/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Url/WebUrlService.cs">https://github.com/aspnetzero/aspnet-ze ... Service.cs</a>.

    Define your interface in your core project, implement it in the web project. Then you can inject your interface in your app project and use it's methods.

  • User Avatar
    0
    cangunaydin created

    Thank you, I will try it.