mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
- 增加 ICodeFirst.IsGenerateCommandParameterWithLambda 选项,开启表达式解析的命令参数化;
- 增加 ExpressionCallContext 自定义函数上下文档 DbParameter 属性; - 修复 IncludeMany(a => a.x1.x2.Childs) 当 x1, x2 为 null 的报 null 错误;
This commit is contained in:
@ -299,6 +299,34 @@ namespace FreeSql.Internal
|
||||
col.Attribute.IsNullable = false;
|
||||
col.Attribute.DbType = col.Attribute.DbType.Replace("NOT NULL", "");
|
||||
}
|
||||
foreach (var col in trytb.Columns.Values)
|
||||
{
|
||||
var ltp = @"\(([^\)]+)\)";
|
||||
col.DbTypeText = Regex.Replace(col.Attribute.DbType.Replace("NOT NULL", "").Trim(), ltp, "");
|
||||
var m = Regex.Match(col.Attribute.DbType, ltp);
|
||||
if (m.Success == false) continue;
|
||||
var sizeStr = m.Groups[1].Value.Trim();
|
||||
if (string.Compare(sizeStr, "max", true) == 0)
|
||||
{
|
||||
col.DbSize = -1;
|
||||
continue;
|
||||
}
|
||||
var sizeArr = sizeStr.Split(',');
|
||||
if (int.TryParse(sizeArr[0].Trim(), out var size) == false) continue;
|
||||
if (col.Attribute.MapType.NullableTypeOrThis() == typeof(DateTime))
|
||||
{
|
||||
col.DbScale = (byte)size;
|
||||
continue;
|
||||
}
|
||||
if (sizeArr.Length == 1)
|
||||
{
|
||||
col.DbSize = size;
|
||||
continue;
|
||||
}
|
||||
if (byte.TryParse(sizeArr[1], out var scale) == false) continue;
|
||||
col.DbPrecision = (byte)size;
|
||||
col.DbScale = scale;
|
||||
}
|
||||
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
||||
|
||||
#region 查找导航属性的关系、virtual 属性延时加载,动态产生新的重写类
|
||||
|
Reference in New Issue
Block a user