コード例 #1
0
        public override SqlProvider FormatUpdate <T>(T entity, string[] excludeFields)
        {
            var update       = ResolveExpression.ResolveUpdates <T>(entity, Params, excludeFields);
            var fromTableSql = FormatTableName(false, false);

            ProviderOption.IsAsName = false;

            var whereSql = ResolveExpression.ResolveWhereList();

            //如果不存在条件,就用主键作为条件
            if (whereSql.Trim().Equals("WHERE 1=1"))
            {
                whereSql += GetIdentityWhere(entity, Params);
            }

            SqlString = $"UPDATE {fromTableSql} {update} {whereSql}";
            return(this);
        }