diff --git a/XCode/Entity/IEntityModule.cs b/XCode/Entity/IEntityModule.cs index 079d54726..e787fa12b 100644 --- a/XCode/Entity/IEntityModule.cs +++ b/XCode/Entity/IEntityModule.cs @@ -223,7 +223,7 @@ protected virtual Boolean SetNoDirtyItem(ICollection fields, IEntity protected virtual Boolean SetItem(ICollection fields, IEntity entity, String name, Object value) { // 没有这个字段,就不想了 - var fi = fields.FirstOrDefault(e => e.Name.EqualIgnoreCase(name)); + var fi = fields.FirstOrDefault(e => name.EqualIgnoreCase(e.Name, e.ColumnName)); if (fi == null) return false; name = fi.Name; diff --git a/XCode/Model/IPModule.cs b/XCode/Model/IPModule.cs index c71b4c04e..7ea50f172 100644 --- a/XCode/Model/IPModule.cs +++ b/XCode/Model/IPModule.cs @@ -69,7 +69,7 @@ protected override Boolean OnValid(IEntity entity, DataMethod method) { foreach (var fi in fs2) { - SetItem(fs2, entity, fi, ip); + SetItem(fs2, entity, fi.Name, ip); } } break; @@ -92,5 +92,5 @@ protected override Boolean OnValid(IEntity entity, DataMethod method) /// 获取实体类的字段名。带缓存 /// /// - protected static FieldItem[] GetIPFieldNames(Type entityType) => _ipFieldNames.GetOrAdd(entityType, t => GetFields(t).Where(e => e.Name.EqualIgnoreCase("CreateIP", "UpdateIP")).ToArray()); + protected static FieldItem[] GetIPFieldNames(Type entityType) => _ipFieldNames.GetOrAdd(entityType, t => GetFields(t).Where(e => e.Name.EqualIgnoreCase(__.CreateIP, __.UpdateIP)).ToArray()); } diff --git a/XCode/Model/UserModule.cs b/XCode/Model/UserModule.cs index 49b1e8b00..5417e1b02 100644 --- a/XCode/Model/UserModule.cs +++ b/XCode/Model/UserModule.cs @@ -48,10 +48,16 @@ protected override Boolean OnInit(Type entityType) { var fs = GetFields(entityType); foreach (var fi in fs) + { if (fi.Type == typeof(Int32) || fi.Type == typeof(Int64)) + { if (fi.Name.EqualIgnoreCase(__.CreateUserID, __.UpdateUserID)) return true; - else if (fi.Type == typeof(String)) - if (fi.Name.EqualIgnoreCase(__.CreateUser, __.UpdateUser)) return true; + } + else if (fi.Type == typeof(String)) + { + if (fi.Name.EqualIgnoreCase(__.CreateUser, __.UpdateUser)) return true; + } + } return false; }