I inherit Database to override a handful of key methods to wrap them with retry policies.
While retargeting my applications I notice that the only constructor available when targeting netcoreapp (any version) seems to be Database(DbConnection connection) and this treats the passed in connection as shared, forcing connection management back on the inheritor.
Implementing the same retries by compositing Database, using the static Create method to avoid a shared DbConnection, appears much more tedious.
It would be very helpful if I could access the private Database(DatabaseType dbType, Func<DbConnection> createConnection) constructor; however, the DatabaseType is internal.
Perhaps this constructor could be added:
public Database(string providerName, Func<DbConnection> createConnection)
: this(DatabaseType.Resolve(null, providerName), createConnection)
{ }
This would allow me to continue letting AsyncPoco handle connection lifetime while also continuing to allow me to effectively override Database methods when targeting the .Net Core runtime.
I can work around this by setting _connectionFactory, _sharedConnection, and _sharedConnectionDepth through reflection in my inheriting class's constructor after calling the base(DbConnection connection) constructor, but a public, non-reflection-based method would be preferable.
Thanks for all your hard work on this library!
I inherit
Databaseto override a handful of key methods to wrap them with retry policies.While retargeting my applications I notice that the only constructor available when targeting netcoreapp (any version) seems to be
Database(DbConnection connection)and this treats the passed in connection as shared, forcing connection management back on the inheritor.Implementing the same retries by compositing
Database, using the staticCreatemethod to avoid a sharedDbConnection, appears much more tedious.It would be very helpful if I could access the
private Database(DatabaseType dbType, Func<DbConnection> createConnection)constructor; however, theDatabaseTypeis internal.Perhaps this constructor could be added:
This would allow me to continue letting AsyncPoco handle connection lifetime while also continuing to allow me to effectively override
Databasemethods when targeting the .Net Core runtime.I can work around this by setting
_connectionFactory,_sharedConnection, and_sharedConnectionDepththrough reflection in my inheriting class's constructor after calling thebase(DbConnection connection)constructor, but a public, non-reflection-based method would be preferable.Thanks for all your hard work on this library!