Skip to content

2.0 Upgrade Guide

Todd Menier edited this page Mar 27, 2018 · 13 revisions

AsyncPoco 2.0 introduces cross-platform support, including .NET Core 1.0 and 2.0, via targets for .NET Standard 1.3 and 2.0. The good news is that by and large, all features ported over nicely. There were a couple exceptions, which I'll enumerate here.

1. A few Database constructors were removed in .NET Core 1.0 and 2.0.

Specifically, these are not available, except on full .NET Framework:

var database = new Database(connectionStringName);
var database = new Database(connectionString, providerName);

This is because dynamic loading of registered ADO.NET providers is entirely absent in .NET Core (although it appears to be coming back in 2.1). Compensating for this is beyond ugly, so the hard decision was made to require passing in a little more information about your database platform. All AsyncPoco really needs to know is the specific DbConnection implementation, so I tried to make this as painless as possible:

// SQL Server:
var database = Database.Create<SqlConnection>(connectionString);
// MySQL:
var database = Database.Create<MySqlConnection>(connectionString);
// PostgreSQL:
var database = Database.Create<NpgsqlConnection>(connectionString);
// Oracle:
var database = Database.Create<OracleConnection>(connectionString);
// SQLite:
var database = Database.Create<SQLiteConnection>(connectionString);

Those all expect (and require) that the connection type has a public parameterless constructor. If you want or need more direct control over creating a connection, this variation is also available:

var database = Database.Create(() => new SqlConnection(...));

2. SQL Server CE is not supported on .NET Core.

Not much to say here. There's no ADO.NET provider for .NET Core, making it impossible to support in AsyncPoco.

Your thoughts?

As of this writing, AsyncPoco 2.0 is available in prerelease but is still a work in progress. If you have thoughts or ideas about the direction this is headed, don't hesitate to open an issue.

Clone this wiki locally