mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-19 20:38:16 +08:00
Internal optimization
This commit is contained in:
@ -151,6 +151,11 @@ namespace FreeSql.Internal.CommonProvider
|
||||
var firstTb = _tables[0];
|
||||
var firstTbs = _tables.Where(a => a.AliasInit == field[0]).ToArray();
|
||||
if (firstTbs.Length == 1) firstTb = firstTbs[0];
|
||||
else
|
||||
{
|
||||
firstTbs = _tables.Where(a => a.Table.Type.Name == field[0]).ToArray();
|
||||
if (firstTbs.Length == 1) firstTb = firstTbs[0];
|
||||
}
|
||||
|
||||
firstTb.Parameter = Expression.Parameter(firstTb.Table.Type, firstTb.Alias);
|
||||
var currentType = firstTb.Table.Type;
|
||||
|
@ -530,16 +530,23 @@ namespace FreeSql.Internal
|
||||
if (col.Attribute.MapType.NullableTypeOrThis() == typeof(DateTime))
|
||||
{
|
||||
col.DbScale = (byte)size;
|
||||
if (col.Attribute.Scale <= 0) col.Attribute.Scale = col.DbScale;
|
||||
continue;
|
||||
}
|
||||
if (sizeArr.Length == 1)
|
||||
{
|
||||
col.DbSize = size;
|
||||
if (col.Attribute.StringLength <= 0) col.Attribute.StringLength = col.DbSize;
|
||||
continue;
|
||||
}
|
||||
if (byte.TryParse(sizeArr[1], out var scale) == false) continue;
|
||||
col.DbPrecision = (byte)size;
|
||||
col.DbScale = scale;
|
||||
if (col.Attribute.Precision <= 0)
|
||||
{
|
||||
col.Attribute.Precision = col.DbPrecision;
|
||||
col.Attribute.Scale = col.DbScale;
|
||||
}
|
||||
}
|
||||
trytb.IsRereadSql = trytb.Columns.Where(a => string.IsNullOrWhiteSpace(a.Value.Attribute.RereadSql) == false).Any();
|
||||
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
||||
|
Reference in New Issue
Block a user