internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state)
        {
            var sql = state.GetDataSql(this, isFullName);

            if (sql != null)
            {
                return(sql);
            }

            object obj    = _baseFieldInfo.CreateSqlString(factory, isFullName, state);
            var    values = (IEnumerable)LambdaExpressionExtend.ConvertLambdaObject(_collection);
            var    list   = new List <string>();

            foreach (var item in values)
            {
                list.Add(state.AddDataParameter(factory, _baseFieldInfo.ToParameter(item.AdjustValue())));
            }

            if (list.Count > 0)
            {
                sql = factory.CreateCollectionParamsQuerySql(obj,
                                                             _isNot ? QueryCollectionPredicate.NotIn : QueryCollectionPredicate.In, list);
            }
            else
            {
                var value = _isNot;
                sql = factory.CreateBooleanConstantSql(value);
            }
            state.SetDataSql(this, isFullName, sql);
            return(sql);
        }
示例#2
0
        internal override string CreateSqlString(CommandFactory factory, bool isFullName, CreateSqlState state)
        {
            string sql = state.GetDataSql(this, isFullName);

            if (sql != null)
            {
                return(sql);
            }

            object        obj    = _baseFieldInfo.CreateSqlString(factory, isFullName, state);
            IEnumerable   values = (IEnumerable)LambdaExpressionExtend.ConvertLambdaObject(_collection);
            List <string> list   = new List <string>();

            foreach (object item in values)
            {
                list.Add(state.AddDataParameter(factory, _baseFieldInfo.ToParameter(item)));
            }

            sql = factory.CreateCollectionParamsQuerySql(obj, _isNot ? QueryCollectionPredicate.NotIn : QueryCollectionPredicate.In, list);
            state.SetDataSql(this, isFullName, sql);
            return(sql);
        }