-
Notifications
You must be signed in to change notification settings - Fork 127
netcore
.net Core does not contain the ADO DataProvider system, so the API is a little different. The ADO DataProviderFactory had configuration information in machine/app.config to initialize it for you. This is not available in .net Core, so you must create the ADO connection object yourself, and assign the connection string.
- Use nuget to get your ADO client
- Install package System.Data.SqlClient
- OR Install package Microsoft.Data.Sqlite
- OR Install package Npgsql
- OR Install package ... others ...
-
Ideally in a simple "using" block, create the client's connection, with the connection string (no need to Open it)
-
Create the DatabaseReader(connection) passing in the connection.
-
Use the DatabaseReader methods as required to get the schema (ReadAll() loads everything)
using (var connection = new SqlConnection("Data Source=.\SQLEXPRESS;Integrated Security=true;Initial Catalog=Northwind"))
{
var dr = new DatabaseSchemaReader.DatabaseReader(connection);
var schema = dr.ReadAll();
//do something with your schema - see other pages in the wiki!
}
We now support SqlServer, SqlServerCe, Sqlite, PostgreSql, MySql and Oracle in .net Core (even though at time of writing there are no Oracle .net core clients - we are ready for them when they are released).
If there is demand for other databases in .netStandard, create an issue: https://github.com/martinjw/dbschemareader/issues
Most of the other features are available- Sql generation, migrations, schema comparisons, and code generation. Procedure ResultSets are only available in Core 2.0 (and the database provider is netstandard 2.0). The only feature not supported is data reading/writing, which will have to wait for a fuller featured .net Core ADO.