Skip to content

Commit 411cfd9

Browse files
committed
Add new DB2CoreDriver to use with IBM.Data.DB2.Core provider
1 parent efbb08a commit 411cfd9

File tree

3 files changed

+59
-56
lines changed

3 files changed

+59
-56
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace NHibernate.Driver
2+
{
3+
/// <summary>
4+
/// A NHibernate Driver for using the IBM.Data.DB2.Core DataProvider.
5+
/// </summary>
6+
public class DB2CoreDriver : DB2DriverBase
7+
{
8+
public DB2CoreDriver() : base("IBM.Data.DB2.Core")
9+
{
10+
}
11+
}
12+
}

src/NHibernate/Driver/DB2Driver.cs

Lines changed: 2 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,12 @@
1-
using System;
2-
using NHibernate.Engine;
3-
41
namespace NHibernate.Driver
52
{
63
/// <summary>
74
/// A NHibernate Driver for using the IBM.Data.DB2 DataProvider.
85
/// </summary>
9-
public class DB2Driver : ReflectionBasedDriver
6+
public class DB2Driver : DB2DriverBase
107
{
11-
/// <summary>
12-
/// Initializes a new instance of the <see cref="DB2Driver"/> class.
13-
/// </summary>
14-
/// <exception cref="HibernateException">
15-
/// Thrown when the <c>IBM.Data.DB2</c> assembly can not be loaded.
16-
/// </exception>
17-
public DB2Driver() : base(
18-
"IBM.Data.DB2",
19-
"IBM.Data.DB2",
20-
"IBM.Data.DB2.DB2Connection",
21-
"IBM.Data.DB2.DB2Command")
8+
public DB2Driver() : base("IBM.Data.DB2")
229
{
2310
}
24-
25-
public override bool UseNamedPrefixInSql
26-
{
27-
get { return false; }
28-
}
29-
30-
public override bool UseNamedPrefixInParameter
31-
{
32-
get { return false; }
33-
}
34-
35-
public override string NamedPrefix
36-
{
37-
get { return String.Empty; }
38-
}
39-
40-
public override bool SupportsMultipleOpenReaders
41-
{
42-
get { return false; }
43-
}
44-
45-
/// <summary>
46-
/// Gets a value indicating whether the driver [supports multiple queries].
47-
/// </summary>
48-
/// <value>
49-
/// <c>true</c> if [supports multiple queries]; otherwise, <c>false</c>.
50-
/// </value>
51-
public override bool SupportsMultipleQueries
52-
{
53-
get { return true; }
54-
}
55-
56-
/// <summary>
57-
/// Gets the result sets command.
58-
/// </summary>
59-
/// <param name="session">The implementor of the session.</param>
60-
/// <returns></returns>
61-
public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor session)
62-
{
63-
return new BasicResultSetsCommand(session);
64-
}
6511
}
6612
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using NHibernate.Engine;
2+
3+
namespace NHibernate.Driver
4+
{
5+
/// <summary>
6+
/// A base for NHibernate Driver for using the IBM.Data.DB2 or IBM.Data.DB2.Core DataProvider.
7+
/// </summary>
8+
public abstract class DB2DriverBase : ReflectionBasedDriver
9+
{
10+
/// <param name="assemblyName"></param>
11+
/// <exception cref="HibernateException">
12+
/// Thrown when the <c>assemblyName</c> assembly can not be loaded.
13+
/// </exception>
14+
protected DB2DriverBase(string assemblyName) :
15+
base(assemblyName, assemblyName, assemblyName + ".DB2Connection", assemblyName + ".DB2Command")
16+
{
17+
}
18+
19+
public override bool UseNamedPrefixInSql => false;
20+
21+
public override bool UseNamedPrefixInParameter => false;
22+
23+
public override string NamedPrefix => string.Empty;
24+
25+
public override bool SupportsMultipleOpenReaders => false;
26+
27+
/// <summary>
28+
/// Gets a value indicating whether the driver [supports multiple queries].
29+
/// </summary>
30+
/// <value>
31+
/// <c>true</c> if [supports multiple queries]; otherwise, <c>false</c>.
32+
/// </value>
33+
public override bool SupportsMultipleQueries => true;
34+
35+
/// <summary>
36+
/// Gets the result sets command.
37+
/// </summary>
38+
/// <param name="session">The implementor of the session.</param>
39+
/// <returns></returns>
40+
public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor session)
41+
{
42+
return new BasicResultSetsCommand(session);
43+
}
44+
}
45+
}

0 commit comments

Comments
 (0)