| | |
| | | } |
| | | |
| | | PropertyInfo propertyInfo = entityInfo.EntityColumnInfo.PropertyInfo; |
| | | SequenceAttirbute? sequenceAttirbute = propertyInfo.GetCustomAttribute<SequenceAttirbute>(); |
| | | SequenceAttribute? sequenceAttirbute = propertyInfo.GetCustomAttribute<SequenceAttribute>(); |
| | | if (sequenceAttirbute != null) |
| | | { |
| | | if (propertyInfo.GetValue(entityInfo.EntityValue)?.ObjToInt() <= 0) |
| | |
| | | ConfigId = MainDb.CurrentDbConnId, |
| | | ConnectionString = DBContext.GetMainConnectionDb().Connection, |
| | | IsAutoCloseConnection = true, |
| | | DbType = MainDb.DbType, |
| | | DbType = DBContext.DbType, |
| | | }); |
| | | int count = sugarClient.Ado.GetScalar($"SELECT COUNT(*) FROM sys.sequences WHERE name = '{sequenceAttirbute.SequenceName}'").ObjToInt(); |
| | | if (count == 0) |
| | |
| | | } |
| | | } |
| | | } |
| | | |
| | | if (entityInfo.EntityValue is IBaseHistoryEntity baseHistoryEntity) |
| | | { |
| | | if (entityInfo.OperationType == DataFilterType.InsertByObject && entityInfo.PropertyName == nameof(IBaseHistoryEntity.InsertTime)) |
| | | { |
| | | baseHistoryEntity.InsertTime = DateTime.Now; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |