I have a .NET Standard 2.0 assembly that I have been using with my MVC and Webforms applications to do some Entity Framework stuff. In all the applications I have simply used:
ConfigurationManager.ConnectionStrings[""]
however .NET Core does not support this and instead insists that I use Configuration.
So I have two questions:
- Is there a built in platform agnostic (does not matter if it is Webforms, MVC, .NET Core) way I can use in .NET Standard to read connection strings?
- From within a .NET Standard assembly how do I determine if I am being called from .NET Core vs Anything else so that I can use either
Configuration
orConfigurationManager
? I am guessing I am going to have to liberally sprinkle target framework conditionals everywhere?