.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
Install package Microsoft.Data.Sqlite
Install package Npgsql
Install package ... others ...

2. Ideally in a simple "using" block, create the client's connection, with the connection string (no need to Open it)
3. Create the DatabaseReader(connection) passing in the connection.
4. 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 MySql or 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:

Most of the other features are available- Sql generation, migrations, schema comparisons, and code generation. The only feature not supported is data reading/writing, which will have to wait for a fuller featured .net Core ADO.

Last edited Jul 22, 2016 at 6:43 PM by Martinjw, version 1


No comments yet.