Kros.KORM.Extensions.Asp 1.1.0-alpha.2
Pre-releaseNew Features
Support for multiple databases/connection strings.
It is possible to add multiple databases to DI container using AddKorm
extension methods. Every database is identified by its name. If connection string is in appsettings.json
, the name of the database is the same as the name of connection string.
Database can be retrieved by name using IDatabaseFactory
- which should be used as a dependency in services.
The first database added to service collection can be retrieved as IDatabase
dependency. So if just one database is used, there is no need using IDatabaseFactory
.
Breaking Changes
Sections ConnectionString
and KormMigrations
in appsettings.json
are not used anymore. All information about connection strings are in standard ConnectionStrings
section as key-value pairs (name - connection string).
Special KORM settings can be set in connection string itself, so the connection string may look:
"ConnectionStrings": {
"DefaultConnection": "Server=servername\\instance; Initial Catalog=databasename; Integrated Security=true; KormAutoMigrate=true"
}
- Automatic migrations can be set as key
KormAutoMigrate
with boolean (true
/false
) value. - SQL provider key name is
KormProvider
. It is not needed, the default Microsoft SQL Server provider will be used.