mirror of
https://github.com/nsnail/FreeSql.git
synced 2025-06-20 04:48:16 +08:00
- 补充 nuget 包增加 xmlDoc 编译;
- 调整 Column.Unique 定义规则,解决同一属性不可配置多次的问题;
This commit is contained in:
@ -101,7 +101,7 @@ namespace FreeSql.Internal {
|
||||
if (trycol._IsNullable != null) attr._IsNullable = trycol.IsNullable;
|
||||
if (trycol._IsIgnore != null) attr._IsIgnore = trycol.IsIgnore;
|
||||
if (trycol._IsVersion != null) attr._IsVersion = trycol.IsVersion;
|
||||
if (!string.IsNullOrEmpty(trycol.Unique)) attr.Unique = trycol.Unique;
|
||||
if (trycol._Uniques != null) attr._Uniques = trycol._Uniques;
|
||||
if (trycol.MapType != null) attr.MapType = trycol.MapType;
|
||||
if (trycol.DbDefautValue != null) attr.DbDefautValue = trycol.DbDefautValue;
|
||||
}
|
||||
@ -117,7 +117,7 @@ namespace FreeSql.Internal {
|
||||
if (tryattr._IsNullable != null) attr._IsNullable = tryattr.IsNullable;
|
||||
if (tryattr._IsIgnore != null) attr._IsIgnore = tryattr.IsIgnore;
|
||||
if (tryattr._IsVersion != null) attr._IsVersion = tryattr.IsVersion;
|
||||
if (!string.IsNullOrEmpty(tryattr.Unique)) attr.Unique = tryattr.Unique;
|
||||
if (tryattr._Uniques != null) attr._Uniques = tryattr._Uniques;
|
||||
if (tryattr.MapType != null) attr.MapType = tryattr.MapType;
|
||||
if (tryattr.DbDefautValue != null) attr.DbDefautValue = tryattr.DbDefautValue;
|
||||
}
|
||||
@ -130,7 +130,7 @@ namespace FreeSql.Internal {
|
||||
if (attr._IsNullable != null) ret = attr;
|
||||
if (attr._IsIgnore != null) ret = attr;
|
||||
if (attr._IsVersion != null) ret = attr;
|
||||
if (!string.IsNullOrEmpty(attr.Unique)) ret = attr;
|
||||
if (attr._Uniques != null) ret = attr;
|
||||
if (attr.MapType != null) ret = attr;
|
||||
if (attr.DbDefautValue != null) ret = attr;
|
||||
if (ret != null && ret.MapType == null) ret.MapType = proto.PropertyType;
|
||||
|
@ -91,11 +91,11 @@ namespace FreeSql.Internal {
|
||||
if (string.IsNullOrEmpty(colattr.Name)) colattr.Name = p.Name;
|
||||
if (common.CodeFirst.IsSyncStructureToLower) {
|
||||
colattr.Name = colattr.Name.ToLower();
|
||||
if (!string.IsNullOrEmpty(colattr.Unique)) colattr.Unique = colattr.Unique.ToLower();
|
||||
colattr.Unique = colattr.Unique?.ToLower();
|
||||
}
|
||||
if (common.CodeFirst.IsSyncStructureToUpper) {
|
||||
colattr.Name = colattr.Name.ToUpper();
|
||||
if (!string.IsNullOrEmpty(colattr.Unique)) colattr.Unique = colattr.Unique.ToUpper();
|
||||
colattr.Unique = colattr.Unique?.ToUpper();
|
||||
}
|
||||
|
||||
if ((colattr.IsNullable != true || colattr.IsIdentity == true || colattr.IsPrimary == true) && colattr.DbType.Contains("NOT NULL") == false) {
|
||||
@ -179,7 +179,8 @@ namespace FreeSql.Internal {
|
||||
foreach (var dbcol in dbuk.Value) {
|
||||
if (trytb.Columns.TryGetValue(dbcol.Name, out var trycol) && trycol.Attribute.MapType == dbcol.CsType ||
|
||||
trytb.ColumnsByCs.TryGetValue(dbcol.Name, out trycol) && trycol.Attribute.MapType == dbcol.CsType) {
|
||||
trycol.Attribute.Unique = dbuk.Key;
|
||||
if (trycol.Attribute._Uniques?.Contains(dbuk.Key) != true)
|
||||
trycol.Attribute.Unique += $"," + dbuk.Key;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -188,8 +189,8 @@ namespace FreeSql.Internal {
|
||||
} catch { }
|
||||
trytb.Primarys = trytb.Columns.Values.Where(a => a.Attribute.IsPrimary == true).ToArray();
|
||||
}
|
||||
trytb.Uniques = trytb.Columns.Values.Where(a => !string.IsNullOrEmpty(a.Attribute.Unique)).Select(a => a.Attribute.Unique).Distinct()
|
||||
.ToDictionary(a => a, a => trytb.Columns.Values.Where(b => b.Attribute.Unique == a).ToList());
|
||||
var allunique = trytb.Columns.Values.Where(a => a.Attribute._Uniques != null).SelectMany(a => a.Attribute._Uniques).Distinct();
|
||||
trytb.Uniques = allunique.ToDictionary(a => a, a => trytb.Columns.Values.Where(b => b.Attribute._Uniques != null && b.Attribute._Uniques.Contains(a)).ToList());
|
||||
tbc.AddOrUpdate(entity, trytb, (oldkey, oldval) => trytb);
|
||||
|
||||
#region 查找导航属性的关系、virtual 属性延时加载,动态产生新的重写类
|
||||
|
Reference in New Issue
Block a user