/// <summary>
        /// 获取一个LinqDLRColumn的新实例
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="columnexpress"></param>
        /// <param name="belongto"></param>
        /// <param name="sqlflags"></param>
        /// <returns></returns>
        public static T New <T>(string columnexpress, LamdaSQLObject <T> belongto, SqlOperatorFlags sqlflags) where T : LinqDLRColumn
        {
            T t = (T)Activator.CreateInstance(typeof(T), true);

            t.ColumnExpress   = columnexpress;
            t.BelongToObject  = belongto;
            t.ConditionValues = new Dictionary <string, object>();
            t.SqlFlags        = sqlflags;


            return(t);
        }
        /// <summary>
        /// 生成一个对象的的栏位表达式
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="value"></param>
        /// <param name="sqlflags"></param>
        /// <returns></returns>
        public static LinqDLRColumn New <T>(object value, SqlOperatorFlags sqlflags) where T : LinqDLRColumn
        {
            if (value is LinqDLRColumn)
            {
                return((LinqDLRColumn)value);
            }

            LinqDLRColumn t = (LinqDLRColumn)Activator.CreateInstance(typeof(T), true);

            t.ConditionValues = new Dictionary <string, object>();
            t.ColumnExpress   = t.Convert2Express(value);
            t.SqlFlags        = sqlflags;
            return(t);
        }
Пример #3
0
 /// <summary>
 /// 构建Lamda表达式对象
 /// </summary>
 /// <param name="table"></param>
 /// <param name="sqlflags"></param>
 public LamdaSQLObject(string table, SqlOperatorFlags sqlflags)
 {
     BelongToTable = table;
     SqlFlags      = sqlflags;
 }
Пример #4
0
        /// <summary>
        /// 生成一个LinqDLRTable的实例
        /// </summary>
        /// <param name="table">实际table的名称</param>
        /// <param name="aliasName">table的别名</param>
        /// <param name="sqlflags">sql相关操作符号</param>
        /// <returns>LinqDLRTable</returns>
        public static LinqDLRTable New <TColumn>(string table, string aliasName = "", SqlOperatorFlags sqlflags = null) where TColumn : LinqDLRColumn
        {
            var tn = aliasName == "" ? table : aliasName;

            sqlflags = sqlflags == null ? new SqlOperatorFlags() : sqlflags;
            LinqDLRTable rtn = New <LinqDLRTable>(new LamdaSQLObject <TColumn>(tn, sqlflags), table, aliasName, new GeneralLinqDLR2SQLGenerator(sqlflags));

            return(rtn);
        }
        /// <summary>
        /// 获取一个LinqDLRColumn的新实例
        /// </summary>
        /// <param name="dlrcolumntype"></param>
        /// <param name="columnexpress"></param>
        /// <param name="belongto"></param>
        /// <param name="sqlflags"></param>
        /// <returns></returns>
        protected static LinqDLRColumn New(Type dlrcolumntype, string columnexpress, object belongto, SqlOperatorFlags sqlflags)
        {
            LinqDLRColumn t = (LinqDLRColumn)Activator.CreateInstance(dlrcolumntype, true);

            t.ColumnExpress   = columnexpress;
            t.BelongToObject  = belongto;
            t.ConditionValues = new Dictionary <string, object>();
            t.SqlFlags        = sqlflags;
            return(t);
        }