public virtual Queue Update <TEntity>(TEntity entity) where TEntity : class, new() { Queue.Sql = new StringBuilder(); var strWhereSql = Visit.Where(Queue.ExpWhere); var strAssemble = Visit.Assign(entity); var readCondition = Visit.ReadCondition(entity); Check.NotEmpty(strAssemble, "更新操作时,当前实体没有要更新的字段。" + typeof(TEntity)); // 主键如果有值、或者设置成只读条件,则自动转成条件 if (!string.IsNullOrWhiteSpace(readCondition)) { strWhereSql += string.IsNullOrWhiteSpace(strWhereSql) ? readCondition : " AND " + readCondition; } if (!string.IsNullOrWhiteSpace(strWhereSql)) { strWhereSql = "WHERE " + strWhereSql; } Queue.Sql.AppendFormat("UPDATE {0} SET {1} {2}", QueueManger.DbProvider.KeywordAegis(Queue.Name), strAssemble, strWhereSql); return(Queue); }