コード例 #1
0
ファイル: UpdateTemplate.cs プロジェクト: ithanshui/Vasily
        /// <summary>
        /// 根据model信息生成 UPDATE [TableName] SET([member1]=@member1,[member2]...=@member2...) WHERE [condition1]=@condition,[condition2]=@condition2.....
        /// </summary>
        /// <param name="model">载有生成信息的Model</param>
        /// <param name="condition_models">需要匹配的成员集合</param>
        /// <returns>更新字符串结果</returns>
        public string UpdateWithCondition(MakerModel model, params MemberInfo[] conditions)
        {
            var               select   = UpdateByCondition(model);
            StringBuilder     sql      = new StringBuilder(select);
            ConditionTemplate template = new ConditionTemplate();

            sql.Append(template.Condition(model, conditions));
            return(sql.ToString());
        }
コード例 #2
0
ファイル: RepeateTemplate.cs プロジェクト: NMSAzulX/Vasily
        // <summary>
        /// 根据model信息生成 SELECT * FROM [TableName] WHERE [Member1]=@Member1 AND [Member2]=@Member2 ....
        /// </summary>
        /// <param name="model">载有生成信息的Model</param>
        /// <returns>查重字符串结果</returns>
        public string RepeateEntities(SqlModel model)
        {
            StringBuilder sql = new StringBuilder(40);

            sql.Append("SELECT * FROM ");
            sql.Append(model.Left);
            sql.Append(model.TableName);
            sql.Append(model.Right);

            ConditionTemplate template = new ConditionTemplate();

            sql.Append(template.Condition(model, model.Members));

            return(sql.ToString());
        }
コード例 #3
0
ファイル: RepeateTemplate.cs プロジェクト: ithanshui/Vasily
        /// <summary>
        /// 根据model信息生成 SELECT COUNT(*) FROM [TableName] WHERE [Member1]=@Member1 AND [Member2]=@Member2 ....
        /// </summary>
        /// <param name="model">载有生成信息的Model</param>
        /// <returns>查重字符串结果</returns>
        public string RepeateCount(MakerModel model)
        {
            StringBuilder sql = new StringBuilder(40);

            sql.Append("SELECT COUNT(*) FROM ");
            sql.Append(model.Left);
            sql.Append(model.TableName);
            sql.Append(model.Right);
            sql.Append(" WHERE ");

            ConditionTemplate template = new ConditionTemplate();

            sql.Append(template.Condition(model, model.Members));

            return(sql.ToString());
        }