Skip to content

Commit

Permalink
update DatabaseProvider class doc comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Ste1io committed Oct 9, 2023
1 parent 93b475d commit d51ec32
Show file tree
Hide file tree
Showing 14 changed files with 69 additions and 28 deletions.
10 changes: 7 additions & 3 deletions PetaPoco/Core/DatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@
namespace PetaPoco.Core
{
/// <summary>
/// The DatabaseProvider class defines a base implementation for database Provider classes, and provides common defaults used by
/// different database management systems.
/// Provides an abstract base class for database providers. This class implements common functionality and provides default behavior for
/// specialized database providers.
/// </summary>
/// <remarks>
/// This class includes methods for database-specific operations like parameter handling, SQL escaping, and paging, among others.
/// Derived classes should override these methods to implement behavior specific to the database they target.
/// </remarks>
public abstract class DatabaseProvider : IProvider
{
private static readonly ConcurrentDictionary<string, IProvider> customProviders = new ConcurrentDictionary<string, IProvider>();
Expand Down Expand Up @@ -101,7 +105,7 @@ protected DbProviderFactory GetFactory(params string[] assemblyQualifiedNames)
if (ft == null)
throw new ArgumentException($"Could not load the {GetType().Name} DbProviderFactory.");

return (DbProviderFactory) ft.GetField("Instance").GetValue(null);
return (DbProviderFactory)ft.GetField("Instance").GetValue(null);
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion PetaPoco/Core/IProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
namespace PetaPoco.Core
{
/// <summary>
/// Represents a contract for a database type provider.
/// Defines the contract for database providers that expose functionality for connecting to various types of databases.
/// </summary>
public interface IProvider
{
Expand Down
14 changes: 7 additions & 7 deletions PetaPoco/OracleProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
namespace PetaPoco
{
/// <summary>
/// Pprovides an implementation of <see cref="DbProviderFactory"/> for early versions of the Oracle drivers that don't include it.
/// Provides an implementation of <see cref="DbProviderFactory"/> for Oracle databases using the unmanaged Oracle Data Provider.
/// </summary>
/// <remarks>
/// For later versions of Oracle, the standard OracleProviderFactory class should work fine.
/// Uses reflection to load Oracle.DataAccess assembly and in-turn create connections and commands.
/// <para>Thanks to Adam Schroder (@schotime) for this.</para>
/// <para><i>Currently untested.</i></para>
/// This provider uses the "Oracle.DataAccess.Client" ADO.NET driver for data access. For later versions of Oracle, the managed <see
/// cref="Providers.OracleDatabaseProvider"/> class should work fine. Uses reflection to load "Oracle.DataAccess" assembly and in-turn
/// create connections and commands.
/// <para>Thanks to Adam Schroder (@schotime) for this. <i>Currently untested.</i></para>
/// </remarks>
/// <example>
/// <code language="cs" title="OracleProvider Usage">
Expand Down Expand Up @@ -69,7 +69,7 @@ public OracleProvider()
/// <returns>A new <see cref="DbConnection"/>.</returns>
public override DbConnection CreateConnection()
{
return (DbConnection) Activator.CreateInstance(_connectionType);
return (DbConnection)Activator.CreateInstance(_connectionType);
}

/// <summary>
Expand All @@ -78,7 +78,7 @@ public override DbConnection CreateConnection()
/// <returns>A new <see cref="DbCommand"/>.</returns>
public override DbCommand CreateCommand()
{
DbCommand command = (DbCommand) Activator.CreateInstance(_commandType);
DbCommand command = (DbCommand)Activator.CreateInstance(_commandType);

var oracleCommandBindByName = _commandType.GetProperty("BindByName");
oracleCommandBindByName.SetValue(command, true, null);
Expand Down
6 changes: 5 additions & 1 deletion PetaPoco/Providers/FirebirdDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: FirebirdDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for Firebird.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Firebird databases.
/// </summary>
/// <remarks>
/// This provider uses the "FirebirdSql.Data.FirebirdClient" ADO.NET driver for data access.
/// </remarks>
public class FirebirdDbDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
10 changes: 7 additions & 3 deletions PetaPoco/Providers/MSAccessDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: MSAccessDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for Microsoft Access.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Microsoft Access databases.
/// </summary>
/// <remarks>
/// This provider uses the "System.Data.OleDb" ADO.NET driver for data access.
/// </remarks>
public class MsAccessDbDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand All @@ -39,10 +43,10 @@ public override async Task<object> ExecuteInsertAsync(CancellationToken cancella
#endif

/// <summary>
/// Page queries are not supported by MsAccess database.
/// Page queries are not supported by MS Access database.
/// </summary>
/// <returns>This method always throws a <see cref="NotSupportedException"/>.</returns>
/// <exception cref="NotSupportedException">The MsAccess provider does not support paging.</exception>
/// <exception cref="NotSupportedException">The MS Access provider does not support paging.</exception>
/// <inheritdoc/>
public override string BuildPageQuery(long skip, long take, SQLParts parts, ref object[] args)
=> throw new NotSupportedException("The MS Access provider does not support paging.");
Expand Down
5 changes: 3 additions & 2 deletions PetaPoco/Providers/MariaDBDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: MariaDBDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for MariaDB.
/// Provides an implementation of <see cref="DatabaseProvider"/> for MariaDB databases.
/// </summary>
/// <remarks>
/// This class uses the <see cref="MySqlDatabaseProvider"/> provider.
/// This provider uses the "MySql.Data.MySqlClient" ADO.NET driver for data access.
/// </remarks>
public class MariaDbDatabaseProvider : DatabaseProvider
{
Expand Down
5 changes: 4 additions & 1 deletion PetaPoco/Providers/MySqlConnectorDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
namespace PetaPoco.Providers
{
/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for MySQL using the MySqlConnector library.
/// Provides an implementation of <see cref="DatabaseProvider"/> for MySQL databases using the MySqlConnector library.
/// </summary>
/// <remarks>
/// This provider uses the "MySqlConnector" ADO.NET driver for data access.
/// </remarks>
public class MySqlConnectorDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
5 changes: 4 additions & 1 deletion PetaPoco/Providers/MySqlDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
namespace PetaPoco.Providers
{
/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for MySQL.
/// Provides an implementation of <see cref="DatabaseProvider"/> for MySQL databases.
/// </summary>
/// <remarks>
/// This provider uses the "MySql.Data.MySqlClient" ADO.NET driver for data access.
/// </remarks>
public class MySqlDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
5 changes: 4 additions & 1 deletion PetaPoco/Providers/OracleDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,11 @@
namespace PetaPoco.Providers
{
/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for Oracle.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Oracle databases using the managed Oracle Data Provider.
/// </summary>
/// <remarks>
/// This provider uses the "Oracle.ManagedDataAccess.Client" ADO.NET driver for data access.
/// </remarks>
public class OracleDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
6 changes: 5 additions & 1 deletion PetaPoco/Providers/PostgresDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: PostgresDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for PostgreSQL.
/// Provides an implementation of <see cref="DatabaseProvider"/> for PostgreSQL databases.
/// </summary>
/// <remarks>
/// This provider uses the "Npgsql" ADO.NET driver for data access.
/// </remarks>
public class PostgreSQLDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
7 changes: 5 additions & 2 deletions PetaPoco/Providers/SQLiteDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
namespace PetaPoco.Providers
{
/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for SQLite.
/// Provides an implementation of <see cref="DatabaseProvider"/> for SQLite databases.
/// </summary>
/// <remarks>
/// This provider can use either the "System.Data.SQLite" or "Microsoft.Data.Sqlite" ADO.NET drivers for data access.
/// </remarks>
public class SQLiteDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand All @@ -19,7 +22,7 @@ public override DbProviderFactory GetFactory()
public override object MapParameterValue(object value)
{
if (value is uint u)
return (long) u;
return (long)u;

return base.MapParameterValue(value);
}
Expand Down
7 changes: 6 additions & 1 deletion PetaPoco/Providers/SqlServerCeDatabaseProviders.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: SqlServerCeDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for SQL Server CE.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Microsoft SQL Server Compact Edition databases.
/// </summary>
/// <remarks>
/// This provider uses the "System.Data.SqlServerCe" ADO.NET driver for data access. Note that this driver is end-of-life (<a
/// href="https://learn.microsoft.com/en-us/lifecycle/products/microsoft-sql-server-compact-40/">reference</a>).
/// </remarks>
public class SqlServerCEDatabaseProviders : DatabaseProvider
{
/// <inheritdoc/>
Expand Down
10 changes: 8 additions & 2 deletions PetaPoco/Providers/SqlServerDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,14 @@
namespace PetaPoco.Providers
{
/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for SQL Server.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Microsoft SQL Server databases.
/// </summary>
/// <remarks>
/// This provider uses the "System.Data.SqlClient" ADO.NET driver for data access. Note that this driver is end-of-life (<see
/// href="https://learn.microsoft.com/en-us/sql/connect/ado-net/introduction-microsoft-data-sqlclient-namespace/">reference</see> and
/// <see href="https://www.connectionstrings.com/the-new-microsoft-data-sqlclient-explained/">more info</see>). Consider using <see
/// cref="SqlServerMsDataDatabaseProvider"/> as an alternative, which uses the "Microsoft.Data.SqlClient" driver.
/// </remarks>
public class SqlServerDatabaseProvider : DatabaseProvider
{
/// <inheritdoc/>
Expand All @@ -20,7 +26,7 @@ public override DbProviderFactory GetFactory()
/// <inheritdoc/>
public override string BuildPageQuery(long skip, long take, SQLParts parts, ref object[] args)
{
var helper = (PagingHelper) PagingUtility;
var helper = (PagingHelper)PagingUtility;
// when the query does not contain an "order by", it is very slow
if (helper.SimpleRegexOrderBy.IsMatch(parts.SqlSelectRemoved))
{
Expand Down
5 changes: 3 additions & 2 deletions PetaPoco/Providers/SqlServerMSDataDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
namespace PetaPoco.Providers
{
// TODO: Rename class: SqlServerMSDataDatabaseProvider

/// <summary>
/// Provides a specific implementation of the <see cref="DatabaseProvider"/> class for Microsoft.Data.SqlClient.
/// Provides an implementation of <see cref="DatabaseProvider"/> for Microsoft SQL Server databases.
/// </summary>
/// <remarks>
/// This class serves as a wrapper for the <see cref="SqlServerDatabaseProvider"/> class.
/// This provider uses the "Microsoft.Data.SqlClient" ADO.NET driver for data access.
/// </remarks>
public class SqlServerMsDataDatabaseProvider : SqlServerDatabaseProvider
{
Expand Down

0 comments on commit d51ec32

Please sign in to comment.