Skip to content

Commit 4da33b7

Browse files
David EllingsworthDavid Ellingsworth
David Ellingsworth
authored and
David Ellingsworth
committed
nhibernateGH-3530: Add TypeOfConnection and TypeOfCommand properties to the ReflectionBasedDriver to allow derived classes to access the type information.
1 parent f135115 commit 4da33b7

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/NHibernate/Driver/ReflectionBasedDriver.cs

+8-5
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,10 @@ protected ReflectionBasedDriver(string driverAssemblyName, string connectionType
4141
protected ReflectionBasedDriver(string providerInvariantName, string driverAssemblyName, string connectionTypeName, string commandTypeName)
4242
{
4343
// Try to get the types from an already loaded assembly
44-
var connectionType = ReflectHelper.TypeFromAssembly(connectionTypeName, driverAssemblyName, false);
45-
var commandType = ReflectHelper.TypeFromAssembly(commandTypeName, driverAssemblyName, false);
44+
TypeOfConnection = ReflectHelper.TypeFromAssembly(connectionTypeName, driverAssemblyName, false);
45+
TypeOfCommand = ReflectHelper.TypeFromAssembly(commandTypeName, driverAssemblyName, false);
4646

47-
if (connectionType == null || commandType == null)
47+
if (TypeOfConnection == null || TypeOfCommand == null)
4848
{
4949
#if NETFX || NETSTANDARD2_1_OR_GREATER
5050
if (string.IsNullOrEmpty(providerInvariantName))
@@ -59,8 +59,8 @@ protected ReflectionBasedDriver(string providerInvariantName, string driverAssem
5959
}
6060
else
6161
{
62-
connectionCommandProvider = new ReflectionDriveConnectionCommandProvider(connectionType, commandType);
63-
DriverVersion = connectionType.Assembly.GetName().Version;
62+
connectionCommandProvider = new ReflectionDriveConnectionCommandProvider(TypeOfConnection, TypeOfCommand);
63+
DriverVersion = TypeOfConnection.Assembly.GetName().Version;
6464
}
6565
}
6666

@@ -73,5 +73,8 @@ public override DbCommand CreateCommand()
7373
{
7474
return connectionCommandProvider.CreateCommand();
7575
}
76+
77+
protected System.Type TypeOfConnection { get; private set; }
78+
protected System.Type TypeOfCommand { get; private set; }
7679
}
7780
}

0 commit comments

Comments
 (0)