X Tutup
using System; using System.Data.Common; namespace Npgsql; /// /// A factory to create instances of various Npgsql objects. /// [Serializable] public sealed class NpgsqlFactory : DbProviderFactory, IServiceProvider { /// /// Gets an instance of the . /// This can be used to retrieve strongly typed data objects. /// public static readonly NpgsqlFactory Instance = new(); NpgsqlFactory() {} /// /// Returns a strongly typed instance. /// public override DbCommand CreateCommand() => new NpgsqlCommand(); /// /// Returns a strongly typed instance. /// public override DbConnection CreateConnection() => new NpgsqlConnection(); /// /// Returns a strongly typed instance. /// public override DbParameter CreateParameter() => new NpgsqlParameter(); /// /// Returns a strongly typed instance. /// public override DbConnectionStringBuilder CreateConnectionStringBuilder() => new NpgsqlConnectionStringBuilder(); /// /// Returns a strongly typed instance. /// public override DbCommandBuilder CreateCommandBuilder() => new NpgsqlCommandBuilder(); /// /// Returns a strongly typed instance. /// public override DbDataAdapter CreateDataAdapter() => new NpgsqlDataAdapter(); /// /// Specifies whether the specific supports the class. /// public override bool CanCreateDataAdapter => true; /// /// Specifies whether the specific supports the class. /// public override bool CanCreateCommandBuilder => true; /// public override bool CanCreateBatch => true; /// public override DbBatch CreateBatch() => new NpgsqlBatch(); /// public override DbBatchCommand CreateBatchCommand() => new NpgsqlBatchCommand(); /// public override DbDataSource CreateDataSource(string connectionString) => NpgsqlDataSource.Create(connectionString); #region IServiceProvider Members /// /// Gets the service object of the specified type. /// /// An object that specifies the type of service object to get. /// A service object of type serviceType, or null if there is no service object of type serviceType. public object? GetService(Type serviceType) => null; #endregion }
X Tutup