示例#1
0
        public InsertBuilder(IDbConnection conn, T entity) : base(conn)
        {
            var properties = DefaultResolver.ResolveProperties(type, true);

            foreach (var p in properties)
            {
                var fieldName = DefaultResolver.ResolveColumnName(p);
                FieldBuilder.Append(FieldBuilder.Length > 0 ? $",{fieldName}" : fieldName);
                var paramterName = GetNewParamter();
                SetParamter(paramterName, p.GetValue(entity, null));
                ValueBuilder.Append(ValueBuilder.Length > 0 ? $",{paramterName}" : paramterName);
            }
        }
示例#2
0
        public UpdateBuilder(IDbConnection conn, T entity) : base(conn)
        {
            var properties = DefaultResolver.ResolveProperties(type, true);

            foreach (var p in properties)
            {
                var fieldName    = DefaultResolver.ResolveColumnName(p);
                var paramterName = GetNewParamter();
                var sql          = $"{fieldName}={paramterName}";
                SetFieldBuilder.Append(SetFieldBuilder.Length > 0 ? $",{sql}" : $" SET {sql}");
                SetParamter(paramterName, p.GetValue(entity, null));
            }
            AppendKeyWhere(entity);
        }
示例#3
0
 public string VisitMemberAccess(MemberExpression expression)
 {
     return(DefaultResolver.ResolveColumnName((PropertyInfo)expression.Member));
 }