Skip to content

2.0 Upgrade Guide

Todd Menier edited this page Mar 28, 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 are not supported on .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 provider. 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(...));

In either case, creating the connection is deferred until it's actually needed. (Note that you can also use a constructor that takes a created DbConnection instance. This is not new, and it's supported on all platforms.)

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.

3. T4 Templates and single drop-in file are being dropped.

My impression is that these are not popular features, and rather than continuing to support them indefinitely, 2.0 seems like the right time to trim the fat. If you find either of these features valuable, please chime in here.

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