|
6 | 6 | using NHibernate.AdoNet; |
7 | 7 | using NHibernate.Engine; |
8 | 8 |
|
9 | | -namespace NHibernate.Driver.MySqlConnector |
| 9 | +namespace NHibernate.Driver.MySqlConnector; |
| 10 | + |
| 11 | +/// <summary> |
| 12 | +/// Provides a database driver for MySQL using <a href="https://mysqlconnector.net/">MySqlConnector</a>. |
| 13 | +/// </summary> |
| 14 | +/// <remarks> |
| 15 | +/// Uses <see cref="GenericBatchingBatcherFactory" /> for batching. |
| 16 | +/// </remarks> |
| 17 | +public class MySqlConnectorDriver : DriverBase, IEmbeddedBatcherFactoryProvider |
10 | 18 | { |
11 | | - /// <summary> |
12 | | - /// Provides a database driver for MySQL using <a href="https://mysqlconnector.net/">MySqlConnector</a>. |
13 | | - /// </summary> |
14 | | - /// <remarks> |
15 | | - /// Uses <see cref="GenericBatchingBatcherFactory"/> for batching. |
16 | | - /// </remarks> |
17 | | - public class MySqlConnectorDriver : DriverBase, IEmbeddedBatcherFactoryProvider |
18 | | - { |
19 | | - public override bool UseNamedPrefixInSql => true; |
| 19 | + public override bool UseNamedPrefixInSql => true; |
| 20 | + |
| 21 | + public override bool UseNamedPrefixInParameter => true; |
20 | 22 |
|
21 | | - public override bool UseNamedPrefixInParameter => true; |
| 23 | + public override string NamedPrefix => "@"; |
22 | 24 |
|
23 | | - public override string NamedPrefix => "@"; |
| 25 | + public override bool SupportsMultipleQueries => true; |
24 | 26 |
|
25 | | - public override bool SupportsMultipleQueries => true; |
| 27 | + public override bool SupportsMultipleOpenReaders => false; |
26 | 28 |
|
27 | | - public override bool SupportsMultipleOpenReaders => false; |
| 29 | + /// <summary> |
| 30 | + /// MySqlConnector prepares commands if <b>IgnorePrepare</b> is set to false in the connection string (default is |
| 31 | + /// true), |
| 32 | + /// otherwise calling <see cref="MySqlCommand.Prepare" /> is a no-op. |
| 33 | + /// </summary> |
| 34 | + protected override bool SupportsPreparingCommands => true; |
28 | 35 |
|
29 | | - /// <summary> |
30 | | - /// MySqlConnector prepares commands if <b>IgnorePrepare</b> is set to false in the connection string (default is true), |
31 | | - /// otherwise calling <see cref="MySqlCommand.Prepare"/> is a no-op. |
32 | | - /// </summary> |
33 | | - protected override bool SupportsPreparingCommands => true; |
| 36 | + // As of v5.7, lower dates may "work" but without guarantees. |
| 37 | + // https://dev.mysql.com/doc/refman/5.7/en/datetime.html |
| 38 | + /// <inheritdoc /> |
| 39 | + public override DateTime MinDate => new(1000, 1, 1); |
34 | 40 |
|
35 | | - public override DbConnection CreateConnection() => new MySqlConnection(); |
| 41 | + public System.Type BatcherFactoryClass => typeof(GenericBatchingBatcherFactory); |
36 | 42 |
|
37 | | - public override DbCommand CreateCommand() => new MySqlCommand(); |
| 43 | + public override DbConnection CreateConnection() => new MySqlConnection(); |
38 | 44 |
|
39 | | - public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor session) => new BasicResultSetsCommand(session); |
| 45 | + public override DbCommand CreateCommand() => new MySqlCommand(); |
40 | 46 |
|
41 | | - // As of v5.7, lower dates may "work" but without guarantees. |
42 | | - // https://dev.mysql.com/doc/refman/5.7/en/datetime.html |
43 | | - /// <inheritdoc /> |
44 | | - public override DateTime MinDate => new DateTime(1000, 1, 1); |
45 | | - |
46 | | - public System.Type BatcherFactoryClass => typeof(GenericBatchingBatcherFactory); |
47 | | - } |
| 47 | + public override IResultSetsCommand GetResultSetsCommand(ISessionImplementor session) => new BasicResultSetsCommand(session); |
48 | 48 | } |
0 commit comments