- 增加 fsql.Insert(Dictionary<string, object>) 无实体类插入方法;#481

This commit is contained in:
2881099
2022-03-24 18:06:54 +08:00
parent 56ce675b65
commit dc688adc11
47 changed files with 416 additions and 80 deletions

View File

@ -31,6 +31,7 @@ namespace FreeSql.Internal.Model
/// <returns></returns>
public object GetDbValue(object obj)
{
if (Table.IsDictionaryType) return (obj as Dictionary<string, object>)?.TryGetValue(CsName, out var tryval) == true ? tryval : null;
var dbval = Table.GetPropertyValue(obj, CsName);
//if (ConversionCsToDb != null) dbval = ConversionCsToDb(dbval);
if (Attribute.MapType != CsType) dbval = Utils.GetDataReaderValue(Attribute.MapType, dbval);
@ -40,7 +41,11 @@ namespace FreeSql.Internal.Model
/// 获取 obj.CsName 属性原始值(不经过 MapType
/// </summary>
/// <param name="obj"></param>
public object GetValue(object obj) => Table.GetPropertyValue(obj, CsName);
public object GetValue(object obj)
{
if (Table.IsDictionaryType) return (obj as Dictionary<string, object>)?.TryGetValue(CsName, out var tryval) == true ? tryval : null;
return Table.GetPropertyValue(obj, CsName);
}
/// <summary>
/// 设置 obj.CsName 属性值
/// </summary>

View File

@ -25,6 +25,7 @@ namespace FreeSql.Internal.Model
public bool DisableSyncStructure { get; set; }
public string Comment { get; internal set; }
public bool IsRereadSql { get; internal set; }
public bool IsDictionaryType { get; internal set; }
public ColumnInfo VersionColumn { get; set; }