Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Using Enterprise Library 6 with ASP .NET 5

$
0
0

DatabaseFactory previously used ConnectionString to create database. Now DatabaseProviderFactory uses ConfigurationSource which basically works on MVC 5 structure of web.config in XML form.

Previously we could do something like below:

string stConnName = Configuration["Data:DefaultConnection:ConnectionString"];
   string stProvider = Configuration["Data:DefaultConnection:ProviderName"];
   Database oDb = DatabaseFactory.CreateDatabase(stConnName);

Any idea about how to get JSON based database configurations as currently being used in MVC 6 (appsettings.json) for EnterpriseLibrary 6 in DatabaseProviderFactory , in order to create generic Database. Basically in order to do something like below, which only works with MVC 5's web.config files of XML form:

    FileConfigurationSource fileConfig = new FileConfigurationSource("web.config");
    DatabaseProviderFactory dbProvider = new DatabaseProviderFactory(fileConfig);
    Database oDb = dbProvider.Create("DBConnection");

Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>