コード例 #1
0
 /// <summary>
 /// Add a new connection to the configuration context.
 /// </summary>
 /// <param name="connectionName"></param>
 /// <param name="connectionString"></param>
 /// <param name="providerName"></param>
 public static void AddConnectionString(String connectionName, String connectionString, String providerName = null)
 {
     ConnectionStrings.AddOrUpdate(connectionName, connectionString, (name, old) => connectionString);
     if (providerName != null)
     {
         var factory = DatabaseConfigurationContext.GetProviderFactory(providerName);
         DbProviders.AddOrUpdate(connectionName, factory, (name, oldFactory) => factory);
     }
 }
コード例 #2
0
ファイル: SqlDialectVariant.cs プロジェクト: gonbike/Destrier
        public static ISqlDialectVariant GetSqlDialect(String connectionName)
        {
            var provider = DatabaseConfigurationContext.GetProviderForConnection(connectionName);

            if (provider is Npgsql.NpgsqlFactory)
            {
                return(ReflectionHelper.GetNewObject <PostgresSqlDialectVariant>());
            }
            else
            {
                return(ReflectionHelper.GetNewObject <SqlServerSqlDialectVariant>());
            }
        }
コード例 #3
0
ファイル: Execute.cs プロジェクト: gonbike/Destrier
            public static void AddParametersToCommand(dynamic procedureParams, DbCommand cmd, String connectionName = null)
            {
                DbProviderFactory provider = DatabaseConfigurationContext.GetProviderForConnection(connectionName);

                AddParametersToCommandFromProvider(procedureParams, cmd, provider);
            }
コード例 #4
0
ファイル: Execute.cs プロジェクト: gonbike/Destrier
            public static void AddParameterToCommand(String name, Object value, DbCommand cmd, String connectionName = null, DbType?dbType = null)
            {
                DbProviderFactory provider = DatabaseConfigurationContext.GetProviderForConnection(connectionName);

                AddParameterToCommand(name, value, cmd, provider: provider);
            }