Skip to content
Martin Willey edited this page Aug 28, 2017 · 2 revisions

.net Core

.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.

  1. 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 ...
  1. Ideally in a simple "using" block, create the client's connection, with the connection string (no need to Open it)

  2. Create the DatabaseReader(connection) passing in the connection.

  3. 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.

Clone this wiki locally