예제 #1
0
 public TableWhereExpresionVisitor(IDialectProvider dialectProvider,
                                   IDictionary <string, object> parameters,
                                   ModelDefinition modelDefinition)
     : base(dialectProvider, parameters)
 {
     _modelDefinition = modelDefinition;
 }
예제 #2
0
        internal TypedWhereStatement(IDialectProvider dialectProvider)
        {
            _dialectProvider = dialectProvider;
            _modelDefinition = ModelDefinition <T> .Definition;

            WhereStatement.TableName = _dialectProvider.GetQuotedTableName(_modelDefinition);
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the NServiceKit.OrmLite.JoinSqlBuilder&lt;TNewPoco,
 /// TBasePoco&gt; class.
 /// </summary>
 public JoinSqlBuilder(IDialectProvider dialectProvider)
 {
     _dialectProvider = dialectProvider;
     basePocoType     = typeof(TBasePoco);
     baseSchema       = GetSchema(basePocoType);
     baseTableName    = basePocoType.GetModelDefinition().ModelName;
 }
예제 #4
0
 public ColumnWhereExpresionVisitor(IDialectProvider dialectProvider,
                                    IDictionary <string, object> parameters,
                                    string statement)
     : base(dialectProvider, parameters)
 {
     _statement = statement;
 }
예제 #5
0
        /// <summary>
        /// Initializes a new instance of the OrmLiteConnection class.
        /// </summary>
        /// <param name="connection">The inner Connection</param>
        /// <param name="dialectProvider">The dialect provider</param>
        internal OrmConnection(DbConnection connection, IDialectProvider dialectProvider, ILoggerFactory loggerFactory)
        {
            _loggerFactory  = loggerFactory;
            DialectProvider = dialectProvider;
            DbConnection    = connection;

            _logger = loggerFactory.CreateLogger <OrmConnection>();
        }
 public TableWFieldsExpresionVisitor(IDialectProvider dialectProvider,
                                     IDictionary <string, object> parameters,
                                     ModelDefinition modelDefinition,
                                     bool addAliasSpecification)
     : base(dialectProvider, parameters)
 {
     _modelDefinition       = modelDefinition;
     _addAliasSpecification = addAliasSpecification;
 }
예제 #7
0
        public TypedSelectStatement(IDialectProvider dialectProvider)
            : base(dialectProvider)
        {
            _dialectProvider = dialectProvider;
            _modelDefinition = ModelDefinition <T> .Definition;

            Statement.TableName = _dialectProvider.GetQuotedTableName(_modelDefinition);
            Statement.Columns.AddRange(_dialectProvider.GetColumnNames(_modelDefinition));
        }
예제 #8
0
 public static ConnectionFactory CreateInstance(string connectionString,
                                                bool autDisposeConnection,
                                                IDialectProvider dialectProvider)
 {
     if (cf == null)
     {
         cf = new ConnectionFactory(connectionString, autDisposeConnection, dialectProvider);
     }
     return(cf);
 }
예제 #9
0
        public void Can_Select_using_object_Array_Contains([ValueSource(typeof(MyDataClass), nameof(MyDataClass.Dialectproviders))] IDialectProvider _dialectProvider)
        {
            var vals = new object[] { TestEnum.Val0, TestEnum.Val1 };

            var visitor1 = _dialectProvider.ExpressionVisitor <TestType2>();

            visitor1.Where(q => vals.Contains(q.EnumCol) || vals.Contains(q.EnumCol));
            var sql1 = _dialectProvider.ToSelectStatement(visitor1, CommandFlags.None);

            var visitor2 = _dialectProvider.ExpressionVisitor <TestType2>();

            visitor2.Where(q => Sql.In(q.EnumCol, vals) || Sql.In(q.EnumCol, vals));
            var sql2 = _dialectProvider.ToSelectStatement(visitor2, CommandFlags.None);

            Assert.AreEqual(sql1.CommandText, sql2.CommandText);
        }
예제 #10
0
 public MySqlExpressionVisitor(IDialectProvider dialectProvider) : base(dialectProvider)
 {
 }
예제 #11
0
 public OrmConnectionFactory(IDialectProvider dialectProvider, string connectionString)
 {
     _dialectProvider  = dialectProvider;
     _connectionString = connectionString;
 }
예제 #12
0
 protected ExpressionTests(IDialectProvider dialectProvider, string connectionString)
 {
     _connectionFactory = new OrmConnectionFactory(dialectProvider, connectionString);
     _connectionFactory.LoggerFactory = new ConsoleLoggerFactory();
 }
 public TypedDeleteStatement(IDialectProvider dialectProvider)
     : base(dialectProvider)
 {
     _dialectProvider = dialectProvider;
 }
예제 #14
0
 public OrmConnectionFactory(IDialectProvider dialectProvider, string connectionString)
 {
     DialectProvider   = dialectProvider;
     _connectionString = connectionString;
     LoggerFactory     = new DummyLoggerFactory();
 }
 public PostgreSQLExpressionVisitor(IDialectProvider dialectProvider) : base(dialectProvider)
 {
 }
예제 #16
0
 protected ExpressionVisitor(IDialectProvider dialectProvider,
                             IDictionary <string, object> parameters)
 {
     DialectProvider = dialectProvider;
     Parameters      = parameters;
 }
        /// <summary>Visit column access method.</summary>
        /// <param name="m">The MethodCallExpression to process.</param>
        /// <returns>An object.</returns>
        //protected override object VisitColumnAccessMethod(MethodCallExpression m)
        //{
        //	List<Object> args = this.VisitExpressionList(m.Arguments);
        //	var quotedColName = Visit(m.Object);
        //	string statement;

        //	switch (m.Method.Name)
        //	{
        //		case "Substring":
        //			var startIndex = Int32.Parse(args[0].ToString()) + 1;
        //			if (args.Count == 2)
        //			{
        //				var length = Int32.Parse(args[1].ToString());
        //				statement = string.Format("substr({0}, {1}, {2})", quotedColName, startIndex, length);
        //			}
        //			else
        //				statement = string.Format("substr({0}, {1})", quotedColName, startIndex);
        //			break;
        //		default:
        //			return base.VisitColumnAccessMethod(m);
        //	}
        //	return new PartialSqlString(statement);
        //}

        /// <summary>Visit SQL method call.</summary>
        /// <exception cref="NotSupportedException">Thrown when the requested operation is not supported.</exception>
        /// <param name="m">The MethodCallExpression to process.</param>
        /// <returns>An object.</returns>
        //protected override object VisitSqlMethodCall(MethodCallExpression m)
        //{
        //	List<Object> args = this.VisitExpressionList(m.Arguments);
        //	object quotedColName = args[0];
        //	args.RemoveAt(0);

        //	var statement = "";

        //	switch (m.Method.Name)
        //	{
        //		case "In":
        //			var member = Expression.Convert(m.Arguments[1], typeof(object));
        //			var lambda = Expression.Lambda<Func<object>>(member);
        //			var getter = lambda.Compile();

        //			var inArgs = Sql.Flatten(getter() as IEnumerable);

        //			var sIn = new StringBuilder();
        //			foreach (var e in inArgs)
        //			{
        //				sIn.AppendFormat("{0}{1}",
        //							 sIn.Length > 0 ? "," : "",
        //							 Config.DialectProvider.GetQuotedValue(e, e.GetType()));
        //			}
        //			statement = string.Format("{0} {1} ({2})", quotedColName, m.Method.Name, sIn);
        //			break;
        //		case "Desc":
        //			statement = string.Format("{0} DESC", quotedColName);
        //			break;
        //		case "As":
        //			statement = string.Format("{0} As {1}", quotedColName,
        //				Config.DialectProvider.GetQuotedColumnName(RemoveQuoteFromAlias(args[0].ToString())));
        //			break;
        //		case "Sum":
        //		case "Count":
        //		case "Min":
        //		case "Max":
        //		case "Avg":
        //			statement = string.Format("{0}({1}{2})",
        //								 m.Method.Name,
        //								 quotedColName,
        //								 args.Count == 1 ? string.Format(",{0}", args[0]) : "");
        //			break;
        //		default:
        //			throw new NotSupportedException();
        //	}

        //	return new PartialSqlString(statement);
        //}
        public SqliteExpressionVisitor(IDialectProvider dialectProvider) : base(dialectProvider)
        {
        }
예제 #18
0
 public DynamicCountStatement(IDialectProvider dialectProvider)
 {
     _dialectProvider = dialectProvider;
 }
예제 #19
0
 ///// <summary>
 ///// Initializes a new instance of the OrmLiteConnection class.
 ///// </summary>
 ///// <param name="connection"></param>
 ///// <param name="dialectProvider"></param>
 internal OrmConnection(DbConnection connection, IDialectProvider dialectProvider)
 {
     DialectProvider = dialectProvider;
     DbConnection    = connection;
 }
예제 #20
0
 public ConnectionFactory(string connectionString, IDialectProvider dialectProvider)
     : this(connectionString, true, dialectProvider)
 {
 }
예제 #21
0
 public TypedInsertStatement(IDialectProvider dialectProvider)
 {
     _dialectProvider      = dialectProvider;
     Statement.TableName   = _dialectProvider.GetQuotedTableName(_modelDefinition);
     Statement.HasIdentity = _modelDefinition.FieldDefinitions.Any(x => x.AutoIncrement);
 }
예제 #22
0
 public TypedUpdateStatement(IDialectProvider dialectProvider)
     : base(dialectProvider)
 {
     _dialectProvider    = dialectProvider;
     Statement.TableName = _dialectProvider.GetQuotedTableName(_modelDefinition);
 }
예제 #23
0
 public DynamicSelectStatement(IDialectProvider dialectProvider)
     : base(dialectProvider)
 {
 }
예제 #24
0
        public ConnectionFactory(string connectionString, bool autoDisposeConnection, IDialectProvider dialectProvider)
        {
            ConnectionString      = connectionString;
            AutoDisposeConnection = autoDisposeConnection;

            if (dialectProvider != null)
            {
                Config.DialectProvider = dialectProvider;
            }
        }
예제 #25
0
 protected ExpressionTests(IDialectProvider dialectProvider)
 {
     _dialectProvider = dialectProvider;
     //BasicConfigurator.Configure(new DebugAppender{Layout =  new SimpleLayout()});
 }