| | |
| | | { |
| | | Type type = entity.GetType(); |
| | | Assembly assembly = type.Assembly; |
| | | Type? htyType = assembly.GetType(type.FullName + "_Hty"); |
| | | |
| | | Type? htyType = assembly.GetTypes().FirstOrDefault(t => !t.IsInterface && !t.IsAbstract && type.IsAssignableFrom(t) && typeof(IBaseHistoryEntity).IsAssignableFrom(t)); |
| | | |
| | | //assembly.GetType(type.FullName + "_Hty"); |
| | | if (htyType != null) |
| | | { |
| | | object? obj = Activator.CreateInstance(htyType); |
| | |
| | | PropertyInfo propertyInfo = propertyInfos[i]; |
| | | PropertyInfo? property = type.GetProperty(propertyInfo.Name); |
| | | |
| | | if (property != null) |
| | | if (property != null && property.CanWrite) |
| | | { |
| | | if (propertyInfo.Name == nameof(BaseEntity.Modifier)) |
| | | { |
| | |
| | | } |
| | | } |
| | | if (obj != null) |
| | | _db.InsertableByObject(obj).AS(type.Name + "_Hty").ExecuteCommand(); |
| | | _db.InsertableByObject(obj).AS(htyType.Name).ExecuteCommand(); |
| | | } |
| | | } |
| | | return DeleteData(entity); |