- 优化 string IsNullable = false 时插入 null 自动转为 "" #445;

This commit is contained in:
28810 2020-09-02 19:20:41 +08:00
parent d025603997
commit 8eadde930f
4 changed files with 17 additions and 0 deletions

View File

@ -532,5 +532,14 @@
<param name="that"></param>
<returns></returns>
</member>
<member name="M:Microsoft.Extensions.DependencyInjection.FreeSqlRepositoryDependencyInjection.AddFreeRepository(Microsoft.Extensions.DependencyInjection.IServiceCollection,System.Action{FreeSql.FluentDataFilter},System.Reflection.Assembly[])">
<summary>
批量注入 Repository可以参考代码自行调整
</summary>
<param name="services"></param>
<param name="globalDataFilter"></param>
<param name="assemblies"></param>
<returns></returns>
</member>
</members>
</doc>

View File

@ -92,6 +92,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}

View File

@ -171,6 +171,8 @@ namespace FreeSql.Internal.CommonProvider
col.SetValue(data, val = FreeUtil.NewMongodbId());
}
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}

View File

@ -359,6 +359,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}
}
@ -379,6 +381,8 @@ namespace FreeSql.Internal.CommonProvider
if (changedDict != null && changedDict.ContainsKey(col.Attribute.Name) == false)
changedDict.Add(col.Attribute.Name, true);
}
if (val == null && col.Attribute.MapType == typeof(string) && col.Attribute.IsNullable == false)
col.SetValue(data, val = "");
}
}