-
Notifications
You must be signed in to change notification settings - Fork 33
2.0 Upgrade Guide
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.
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 an existing, open DbConnection
instance. This is not new, and it's supported on all platforms.)
Not much to say here. There's no ADO.NET provider for .NET Core, making it impossible to support in AsyncPoco.
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 part ways. More details about this decision are here. If you do still need the T4 templates, they will forever be available in the 1.x branch.