public DefaultSqlQueryFormatterManager(SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterConstructorMethod constructorMethod)
     : base(sqlDialect)
 {
     this.SqlDialect = sqlDialect;
     this.SqlDataTypeProvider = sqlDataTypeProvider;
     this.ConstructorMethod = constructorMethod;
 }
		protected SqlQueryFormatterManager(SqlDialect sqlDialect)
		{
			this.sqlDialect = sqlDialect;
			this.stringEscape = this.sqlDialect.GetSyntaxSymbolString(SqlSyntaxSymbol.StringEscape);
			this.stringQuote = this.sqlDialect.GetSyntaxSymbolString(SqlSyntaxSymbol.StringQuote); 
			this.parameterPrefix = this.sqlDialect.GetSyntaxSymbolString(SqlSyntaxSymbol.ParameterPrefix);
		}
示例#3
0
		protected SqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, string databaseName, SqlDatabaseContextInfo contextInfo)
		{
			this.DatabaseName = databaseName;
			this.DataAccessModel = model; 
			this.CommandTimeout = contextInfo.CommandTimeout == null ? null : (TimeSpan?)TimeSpan.FromSeconds(contextInfo.CommandTimeout.Value);
			var categories = contextInfo.Categories ?? "";
			this.ContextCategories = categories.Trim().Length == 0 ? new string[0] : categories.Split(',').Select(c => c.Trim()).ToArray();
			this.SqlDialect = sqlDialect;
			this.SqlDataTypeProvider = sqlDataTypeProvider;
			this.SqlQueryFormatterManager = sqlQueryFormatterManager;
			this.SchemaName = EnvironmentSubstitutor.Substitute(contextInfo.SchemaName);
			this.TableNamePrefix = EnvironmentSubstitutor.Substitute(contextInfo.TableNamePrefix);
		}
		protected PostgresSqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, PostgresSqlDatabaseContextInfo contextInfo)
			: base(model, sqlDialect, sqlDataTypeProvider, sqlQueryFormatterManager, contextInfo.DatabaseName, contextInfo)
		{
			this.SupportsPreparedTransactions = contextInfo.EnablePreparedTransactions;

			this.Host = contextInfo.ServerName;
			this.UserId = contextInfo.UserId;
			this.Password = contextInfo.Password;
			this.Port = contextInfo.Port;
			
			var connectionStringBuilder = new NpgsqlConnectionStringBuilder
			{
				Host = contextInfo.ServerName,
				Username = contextInfo.UserId,
				Password = contextInfo.Password,
				Port = contextInfo.Port,
				Pooling = contextInfo.Pooling,
				Enlist = false,
				MinPoolSize = contextInfo.MinPoolSize,
				MaxPoolSize = contextInfo.MaxPoolSize,
				KeepAlive = contextInfo.KeepAlive,
				ConnectionIdleLifetime = contextInfo.ConnectionIdleLifetime,
				ConvertInfinityDateTime = contextInfo.ConvertInfinityDateTime
			};

			if (contextInfo.Timeout != null)
			{
				connectionStringBuilder.Timeout = contextInfo.Timeout.Value;
			}

			if (contextInfo.ConnectionTimeout.HasValue)
			{
				connectionStringBuilder.Timeout = contextInfo.ConnectionTimeout.Value;
			}
			
			if (contextInfo.ConnectionCommandTimeout.HasValue)
			{
				connectionStringBuilder.CommandTimeout = contextInfo.ConnectionCommandTimeout.Value;
			}

			connectionStringBuilder.Database = contextInfo.DatabaseName;

			this.ConnectionString = connectionStringBuilder.ToString();

			connectionStringBuilder.Database = "postgres";

			this.ServerConnectionString = connectionStringBuilder.ToString();

			this.SchemaManager = new PostgresSqlDatabaseSchemaManager(this);
		}
        protected PostgresSqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, PostgresSqlDatabaseContextInfo contextInfo)
            : base(model, sqlDialect, sqlDataTypeProvider, sqlQueryFormatterManager, contextInfo.DatabaseName, contextInfo)
        {
            this.Host = contextInfo.ServerName;
            this.UserId = contextInfo.UserId;
            this.Password = contextInfo.Password;
            this.Port = contextInfo.Port;
            this.CommandTimeout = TimeSpan.FromSeconds(contextInfo.CommandTimeout);

            this.ConnectionString = String.Format("Host={0};User Id={1};Password={2};Database={3};Port={4};Pooling={5};MinPoolSize={6};MaxPoolSize={7};Enlist=false;Timeout={8};CommandTimeout={9}", contextInfo.ServerName, contextInfo.UserId, contextInfo.Password, contextInfo.DatabaseName, contextInfo.Port, contextInfo.Pooling, contextInfo.MinPoolSize, contextInfo.MaxPoolSize, contextInfo.ConnectionTimeout, contextInfo.CommandTimeout);
            this.ServerConnectionString = Regex.Replace(this.ConnectionString, @"Database\s*\=[^;]+[;$]", "Database=postgres;");

            this.SchemaManager = new PostgresSharedSqlDatabaseSchemaManager(this);
        }
        protected PostgresDotConnectSqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, PostgresDotConnectSqlDatabaseContextInfo contextInfo)
            : base(model, sqlDialect, sqlDataTypeProvider, sqlQueryFormatterManager, contextInfo.DatabaseName, contextInfo)
        {
            if (!string.IsNullOrEmpty(contextInfo.ConnectionString))
            {
                this.ConnectionString = contextInfo.ConnectionString;
                this.ServerConnectionString = Regex.Replace(this.ConnectionString, @"Database\s*\=[^;$]+[;$]", "");
            }
            else
            {
                this.Host = contextInfo.ServerName;
                this.UserId = contextInfo.UserId;
                this.Password = contextInfo.Password;
                this.Port = contextInfo.Port;

                var connectionStringBuilder = new PgSqlConnectionStringBuilder
                {
                    Host = contextInfo.ServerName,
                    UserId = contextInfo.UserId,
                    Password = contextInfo.Password,
                    Port = contextInfo.Port,
                    Pooling = contextInfo.Pooling,
                    Enlist = false,
                    Charset = "UTF8",
                    Unicode = true,
                    MaxPoolSize = contextInfo.MaxPoolSize,
                    UnpreparedExecute = contextInfo.UnpreparedExecute
                };

                if (contextInfo.ConnectionTimeout != null)
                {
                    connectionStringBuilder.ConnectionTimeout = contextInfo.ConnectionTimeout.Value;
                }

                if (contextInfo.ConnectionCommandTimeout != null)
                {
                    connectionStringBuilder.DefaultCommandTimeout = contextInfo.ConnectionCommandTimeout.Value;
                }

                this.ServerConnectionString = connectionStringBuilder.ConnectionString;
                connectionStringBuilder.Database = contextInfo.DatabaseName;
                this.ConnectionString = connectionStringBuilder.ConnectionString;
            }

            this.SchemaManager = new PostgresSqlDatabaseSchemaManager(this);
        }
        protected PostgresSqlDatabaseContext(DataAccessModel model, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, SqlQueryFormatterManager sqlQueryFormatterManager, PostgresSqlDatabaseContextInfo contextInfo)
            : base(model, sqlDialect, sqlDataTypeProvider, sqlQueryFormatterManager, contextInfo.DatabaseName, contextInfo)
        {
            this.Host = contextInfo.ServerName;
            this.UserId = contextInfo.UserId;
            this.Password = contextInfo.Password;
            this.Port = contextInfo.Port;

            var connectionStringBuilder = new NpgsqlConnectionStringBuilder
            {
                Host = contextInfo.ServerName,
                Username = contextInfo.UserId,
                Password = contextInfo.Password,
                Port = contextInfo.Port,
                Pooling = contextInfo.Pooling,
                Enlist = false,
                BackendTimeouts = contextInfo.BackendTimeouts,
                MinPoolSize = contextInfo.MinPoolSize,
                MaxPoolSize = contextInfo.MaxPoolSize
            };

            if (contextInfo.ConnectionTimeout.HasValue)
            {
                connectionStringBuilder.Timeout = contextInfo.ConnectionTimeout.Value;
            }

            if (contextInfo.ConnectionCommandTimeout.HasValue)
            {
                connectionStringBuilder.CommandTimeout = contextInfo.ConnectionCommandTimeout.Value;
            }

            connectionStringBuilder.Database = contextInfo.DatabaseName;

            this.ConnectionString = connectionStringBuilder.ToString();

            connectionStringBuilder.Database = "postgres";

            this.ServerConnectionString = connectionStringBuilder.ToString();

            this.SchemaManager = new PostgresSqlDatabaseSchemaManager(this);
        }
示例#8
0
 public DefaultSqlQueryFormatterManager(SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, Type sqlFormatterType)
     : this(sqlDialect, sqlDataTypeProvider, CreateConstructorMethodFromType(sqlFormatterType))
 {
 }
示例#9
0
 public DefaultSqlQueryFormatterManager(SqlDialect sqlDialect, NamingTransformsConfiguration namingTransformsConfiguration, SqlQueryFormatterConstructorMethod constructorMethod)
     : base(sqlDialect, namingTransformsConfiguration)
 {
     this.SqlDialect        = sqlDialect;
     this.ConstructorMethod = constructorMethod;
 }
		public PostgresSqlQueryFormatter(SqlQueryFormatterOptions options, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, TypeDescriptorProvider typeDescriptorProvider, string schemaName, bool convertEnumsToText)
			: base(options, sqlDialect, sqlDataTypeProvider, typeDescriptorProvider)
		{
			this.schemaName = schemaName;
			this.ConvertEnumsToText = convertEnumsToText;
		}
示例#11
0
 protected SqlQueryFormatterManager(SqlDialect sqlDialect)
 {
     this.sqlDialect      = sqlDialect;
     this.stringQuote     = this.sqlDialect.GetSyntaxSymbolString(SqlSyntaxSymbol.StringQuote);
     this.parameterPrefix = this.sqlDialect.GetSyntaxSymbolString(SqlSyntaxSymbol.ParameterPrefix);
 }
		public static Expression Build(SqlDataTypeProvider sqlDataTypeProvider, SqlDialect sqlDialect)
		{
			return null;
		}
		public PostgresSqlDataDefinitionExpressionBuilder(SqlDatabaseContext sqlDatabaseContext, SqlDataTypeProvider sqlDataTypeProvider, SqlDialect sqlDialect)
		{
			this.SqlDatabaseContext = sqlDatabaseContext;
			this.SqlDataTypeProvider = sqlDataTypeProvider;
			this.SqlDialect = sqlDialect;
		}
		public SqliteSqlQueryFormatter(SqlQueryFormatterOptions options, SqlDialect sqlDialect,  SqlDataTypeProvider sqlDataTypeProvider, TypeDescriptorProvider typeDescriptorProvider)
			: base(options, sqlDialect, sqlDataTypeProvider, typeDescriptorProvider)
		{
		}
		public PostgresDotConnectSqlQueryFormatter(SqlQueryFormatterOptions options, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, TypeDescriptorProvider typeDescriptorProvider, string schemaName, bool convertEnumsToText)
			: base(options, sqlDialect, sqlDataTypeProvider, typeDescriptorProvider, schemaName, convertEnumsToText)
		{
		}
 public SqlServerSqlQueryFormatter(SqlQueryFormatterOptions options, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider)
     : base(options, sqlDialect, sqlDataTypeProvider)
 {
 }
 public PostgresSharedSqlQueryFormatter(SqlQueryFormatterOptions options, SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, string schemaName)
     : base(options, sqlDialect, sqlDataTypeProvider)
 {
     this.schemaName = schemaName;
 }
 public DefaultSqlQueryFormatterManager(SqlDialect sqlDialect, SqlDataTypeProvider sqlDataTypeProvider, Type sqlFormatterType)
     : this(sqlDialect, sqlDataTypeProvider, CreateConstructorMethodFromType(sqlFormatterType))
 {
 }