## v0.3.21

- 增加 IUpdate IgnoreColumns 重载方法,支持传入字符串数组忽略修改;
- 完善 FreeSql.DbContext,支持对象操作 + SaveChanges 最后保存操作;
This commit is contained in:
28810
2019-03-21 05:24:50 +08:00
parent d9de8e986b
commit c20a0bbd54
24 changed files with 815 additions and 48 deletions

View File

@ -395,7 +395,7 @@ namespace FreeSql.Internal.CommonProvider {
Expression.Assign(readExp, readExpAssign),
Expression.IfThen(Expression.GreaterThan(readExpDataIndex, dataIndexExp),
Expression.Assign(dataIndexExp, readExpDataIndex)),
Expression.Call(typeof(Trace).GetMethod("WriteLine", new Type[]{typeof(string)}), Expression.Call(typeof(string).GetMethod("Concat", new Type[]{typeof(object) }), readExpValue)),
//Expression.Call(typeof(Trace).GetMethod("WriteLine", new Type[]{typeof(string)}), Expression.Call(typeof(string).GetMethod("Concat", new Type[]{typeof(object) }), readExpValue)),
Expression.IfThen(Expression.NotEqual(readExpValue, Expression.Constant(null)),
//Expression.Call(retExp, propGetSetMethod, Expression.Default(prop.PropertyType)),
Expression.Call(retExp, propGetSetMethod, Expression.Convert(readExpValue, prop.PropertyType)))

View File

@ -63,6 +63,11 @@ namespace FreeSql.Internal.CommonProvider {
foreach (var col in cols) _ignore.Add(col, true);
return this;
}
public IUpdate<T1> IgnoreColumns(string[] columns) {
_ignore.Clear();
foreach (var col in columns) _ignore.Add(col, true);
return this;
}
public IUpdate<T1> SetSource(T1 source) => this.SetSource(new[] { source });
public IUpdate<T1> SetSource(IEnumerable<T1> source) {

View File

@ -2,7 +2,7 @@
using System;
namespace FreeSql.Internal.Model {
class ColumnInfo {
public class ColumnInfo {
public TableInfo Table { get; set; }
public string CsName { get; set; }
public Type CsType { get; set; }

View File

@ -4,7 +4,7 @@ using System.Collections.Generic;
using System.Reflection;
namespace FreeSql.Internal.Model {
class TableInfo {
public class TableInfo {
public Type Type { get; set; }
public Type TypeLazy { get; set; }
public MethodInfo TypeLazySetOrm { get; set; }

View File

@ -13,7 +13,7 @@ using System.Text;
using System.Text.RegularExpressions;
namespace FreeSql.Internal {
class Utils {
public class Utils {
static ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>> _cacheGetTableByEntity = new ConcurrentDictionary<DataType, ConcurrentDictionary<Type, TableInfo>>();
internal static void RemoveTableByEntity(Type entity, CommonUtils common) {
@ -997,7 +997,7 @@ namespace FreeSql.Internal {
static MethodInfo MethodJTokenParse = typeof(JToken).GetMethod("Parse", new[] { typeof(string) });
static MethodInfo MethodJObjectParse = typeof(JObject).GetMethod("Parse", new[] { typeof(string) });
static MethodInfo MethodJArrayParse = typeof(JArray).GetMethod("Parse", new[] { typeof(string) });
internal static Expression GetDataReaderValueBlockExpression(Type type, Expression value) {
public static Expression GetDataReaderValueBlockExpression(Type type, Expression value) {
var returnTarget = Expression.Label(typeof(object));
var valueExp = Expression.Variable(typeof(object), "locvalue");
Func<Expression> funcGetExpression = () => {
@ -1084,7 +1084,7 @@ namespace FreeSql.Internal {
Expression.Label(returnTarget, Expression.Default(typeof(object)))
);
}
internal static object GetDataReaderValue(Type type, object value) {
public static object GetDataReaderValue(Type type, object value) {
if (value == null || value == DBNull.Value) return null;
var func = _dicGetDataReaderValue.GetOrAdd(type, k1 => new ConcurrentDictionary<Type, Func<object, object>>()).GetOrAdd(value.GetType(), valueType => {
var parmExp = Expression.Parameter(typeof(object), "value");