Hi All,
We are developing one application using ABP template (ASP.NET core 1.x + angular 2) and wanted to connect to two databases (MSSQL and Firebird). We are able to connect to MSSQL database, however facing problem while connecting to firebird database.
Before we where using ABP template (ASP:NET MVC + AngularJS) and it was working totally fine with these two databases (MSSQL and firebird) and the configuration is set into App.config file.
We try to put the connection string as below into appsettings.json, however it is not working.
"ConnectionStrings": {
"Default": "Server=.; Database=PDVOnlineMaklerNg2Db; Trusted_Connection=True;",
"AmsDefault": "metadata=res://*/AmsDbContext.csdl|res://*/AmsDbContext.ssdl|res://*/AmsDbContext.msl;provider=FirebirdSql.Data.FirebirdClient;provider connection string="data source=pdv-zto-01;initial catalog=D:\\Assfinet\\MVP\\ibdac\\ams64demo.fdb;user id=sysdba;password=masterkey""
},
Now, we have no idea how to write App.config configuraton setting into appsettings.json file.
Below are the configuration files for our ABP template (ASP.NET core 1.x + angular 2)
<ins>App.config</ins>
<configuration>
<configSections>
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</configSections>
<appSettings>
<add key="owin:AutomaticAppStartup" value="false"/>
</appSettings>
<connectionStrings>
<add name="Default" connectionString="Server=.;Database=PDVOnlineMakler;Integrated Security=True;" providerName="System.Data.SqlClient" />
<add name="AmsDefault" connectionString="metadata=res://*/AmsDbContext.csdl|res://*/AmsDbContext.ssdl|res://*/AmsDbContext.msl;provider=FirebirdSql.Data.FirebirdClient;provider connection string="data source=pdv-zto-01;initial catalog=D:\Assfinet\MVP\ibdac\ams64demo.fdb;user id=sysdba;password=masterkey"" providerName="System.Data.EntityClient" />
</connectionStrings>
<runtime>
<gcServer enabled="true"/>
</runtime>
<entityFramework>
<defaultConnectionFactory type="FirebirdSql.Data.EntityFramework6.FbConnectionFactory, EntityFramework.Firebird" />
<providers>
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
<provider invariantName="FirebirdSql.Data.FirebirdClient" type="FirebirdSql.Data.EntityFramework6.FbProviderServices, EntityFramework.Firebird" />
</providers>
</entityFramework>
<system.data>
<DbProviderFactories>
<remove invariant="FirebirdSql.Data.FirebirdClient" />
<add name="FirebirdClient Data Provider" invariant="FirebirdSql.Data.FirebirdClient" description=".NET Framework Data Provider for Firebird" type="FirebirdSql.Data.FirebirdClient.FirebirdClientFactory, FirebirdSql.Data.FirebirdClient" />
</DbProviderFactories>
</system.data>
</configuration>
<ins>appsettings.json</ins>
{
"ConnectionStrings": {
"Default": "Server=.; Database=PDVOnlineMaklerNg2Db; Trusted_Connection=True;"
},
"Authentication": {
"Facebook": {
"IsEnabled": "false",
"AppId": "",
"AppSecret": ""
},
"Google": {
"IsEnabled": "false",
"ClientId": "",
"ClientSecret": ""
},
"JwtBearer": {
"IsEnabled": "true",
"SecurityKey": "PDVOnlineMaklerNg2_C421AAEE0D114E9C",
"Issuer": "PDVOnlineMaklerNg2",
"Audience": "PDVOnlineMaklerNg2"
}
}
}
1 Answer(s)
-
0
Hi,
You can put second connection string into appsettings.json like this
"ConnectionStrings": { "Default": "Server=.; Database=PDVOnlineMaklerNg2Db; Trusted_Connection=True;", "AmsDefault": "your connection string." }
I think you have another DbContext for Firebird, right ? IF so, you can use "AmsDefault" in it's constructor as connection string name.