- 增加 ICodeFirst.IsGenerateCommandParameterWithLambda 选项,开启表达式解析的命令参数化;

- 增加 ExpressionCallContext 自定义函数上下文档 DbParameter 属性;
- 修复 IncludeMany(a => a.x1.x2.Childs) 当 x1, x2 为 null 的报 null 错误;
This commit is contained in:
28810
2019-11-22 21:55:36 +08:00
parent 12be7f0051
commit e9a8ad70a1
54 changed files with 518 additions and 746 deletions

View File

@ -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