コード例 #1
0
        public IDataProvider Create(CustomConnectionStringSettings settings, Transaction transactionMode)
        {
            var provider = ResolveDataProvider(settings.ProviderName);

            provider.DbConnection    = CreateConnection(settings.ProviderName, settings);
            provider.TransactionMode = transactionMode;
            return(provider);
        }
コード例 #2
0
        private IDbConnection CreateConnection(string providerName, CustomConnectionStringSettings settings)
        {
            IDbConnection connection;

            if (ConnectionFactory != null)
            {
                connection = ConnectionFactory(providerName);
            }
            else
            {
                connection = DbProviderFactories.GetFactory(providerName).CreateConnection();
            }

            connection.ConnectionString = settings.ConnectionString;

            return(connection);
        }