diff --git a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs index 50de4f1b56..4ef6057943 100644 --- a/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs +++ b/framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs @@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Volo.Abp.Auditing; +using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Entities; using Volo.Abp.Json; @@ -26,8 +27,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory protected IJsonSerializer JsonSerializer { get; } protected AbpAuditingOptions Options { get; } protected IAuditingHelper AuditingHelper { get; } - - private readonly IClock _clock; + protected IClock Clock{ get; } public EntityHistoryHelper( IAuditingStore auditingStore, @@ -36,7 +36,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory IJsonSerializer jsonSerializer, IAuditingHelper auditingHelper) { - _clock = clock; + Clock = clock; AuditingStore = auditingStore; JsonSerializer = jsonSerializer; AuditingHelper = auditingHelper; @@ -69,7 +69,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory } [CanBeNull] - private EntityChangeInfo CreateEntityChangeOrNull(EntityEntry entityEntry) + protected virtual EntityChangeInfo CreateEntityChangeOrNull(EntityEntry entityEntry) { var entity = entityEntry.Entity; @@ -121,23 +121,23 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return multiTenantEntity.TenantId; } - private DateTime GetChangeTime(EntityChangeInfo entityChange) + protected virtual DateTime GetChangeTime(EntityChangeInfo entityChange) { var entity = entityChange.EntityEntry.As().Entity; switch (entityChange.ChangeType) { case EntityChangeType.Created: - return (entity as IHasCreationTime)?.CreationTime ?? _clock.Now; + return (entity as IHasCreationTime)?.CreationTime ?? Clock.Now; case EntityChangeType.Deleted: - return (entity as IHasDeletionTime)?.DeletionTime ?? _clock.Now; + return (entity as IHasDeletionTime)?.DeletionTime ?? Clock.Now; case EntityChangeType.Updated: - return (entity as IHasModificationTime)?.LastModificationTime ?? _clock.Now; + return (entity as IHasModificationTime)?.LastModificationTime ?? Clock.Now; default: throw new AbpException($"Unknown {nameof(EntityChangeInfo)}: {entityChange}"); } } - private string GetEntityId(object entityAsObj) + protected virtual string GetEntityId(object entityAsObj) { if (!(entityAsObj is IEntity entity)) { @@ -156,7 +156,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory /// /// Gets the property changes for this entry. /// - private List GetPropertyChanges(EntityEntry entityEntry) + protected virtual List GetPropertyChanges(EntityEntry entityEntry) { var propertyChanges = new List(); var properties = entityEntry.Metadata.GetProperties(); @@ -181,12 +181,12 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return propertyChanges; } - private bool IsCreated(EntityEntry entityEntry) + protected virtual bool IsCreated(EntityEntry entityEntry) { return entityEntry.State == EntityState.Added; } - private bool IsDeleted(EntityEntry entityEntry) + protected virtual bool IsDeleted(EntityEntry entityEntry) { if (entityEntry.State == EntityState.Deleted) { @@ -197,7 +197,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return entity is ISoftDelete && entity.As().IsDeleted; } - private bool ShouldSaveEntityHistory(EntityEntry entityEntry, bool defaultValue = false) + protected virtual bool ShouldSaveEntityHistory(EntityEntry entityEntry, bool defaultValue = false) { if (entityEntry.State == EntityState.Detached || entityEntry.State == EntityState.Unchanged) @@ -220,7 +220,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return defaultValue; } - private bool ShouldSavePropertyHistory(PropertyEntry propertyEntry, bool defaultValue) + protected virtual bool ShouldSavePropertyHistory(PropertyEntry propertyEntry, bool defaultValue) { if (propertyEntry.Metadata.Name == "Id") { @@ -247,6 +247,26 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return false; } + if (propertyEntry.OriginalValue is ExtraPropertyDictionary originalValue && propertyEntry.CurrentValue is ExtraPropertyDictionary currentValue) + { + if (originalValue.IsNullOrEmpty() && currentValue.IsNullOrEmpty()) + { + return false; + } + + if (!originalValue.Select(x => x.Key).SequenceEqual(currentValue.Select(x => x.Key))) + { + return true; + } + + if (!originalValue.Select(x => x.Value).SequenceEqual(currentValue.Select(x => x.Value))) + { + return true; + } + + return defaultValue; + } + var isModified = !(propertyEntry.OriginalValue?.Equals(propertyEntry.CurrentValue) ?? propertyEntry.CurrentValue == null); if (isModified) { @@ -256,7 +276,7 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return defaultValue; } - private bool IsBaseAuditProperty(PropertyInfo propertyInfo, Type entityType) + protected virtual bool IsBaseAuditProperty(PropertyInfo propertyInfo, Type entityType) { if (entityType.IsAssignableTo() && propertyInfo.Name == nameof(IHasCreationTime.CreationTime)) @@ -308,11 +328,11 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory return false; } - + /// /// Updates change time, entity id and foreign keys after SaveChanges is called. /// - public void UpdateChangeList(List entityChanges) + public virtual void UpdateChangeList(List entityChanges) { foreach (var entityChange in entityChanges) { @@ -372,4 +392,4 @@ namespace Volo.Abp.EntityFrameworkCore.EntityHistory } } } -} \ No newline at end of file +} diff --git a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs index 53a5a7ec2e..e72f67bbc3 100644 --- a/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs +++ b/framework/test/Volo.Abp.Auditing.Tests/Volo/Abp/Auditing/Auditing_Tests.cs @@ -6,6 +6,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection.Extensions; using NSubstitute; using Volo.Abp.Auditing.App.Entities; +using Volo.Abp.Data; using Volo.Abp.DependencyInjection; using Volo.Abp.Domain.Repositories; using Volo.Abp.Uow; @@ -44,7 +45,7 @@ namespace Volo.Abp.Auditing await _auditingStore.Received().SaveAsync(Arg.Any()); } - + [Fact] public async Task Should_Write_AuditLog_For_Classes_That_Implement_IAuditingEnabled_Without_An_Explicit_Scope() { @@ -280,6 +281,37 @@ namespace Volo.Abp.Auditing .Where(y => y.PropertyName != nameof(AppEntityWithAuditedAndHasCustomAuditingProperties .ExtraProperties)) .All(y => GetBaseAuditPropertyNames().Contains(y.PropertyName)))); +#pragma warning restore 4014 + } + + [Fact] + public virtual async Task Should_Write_AuditLog_Without_ExtraPropertyDictionary() + { + var entityId = Guid.NewGuid(); + var repository = ServiceProvider.GetRequiredService>(); + var appEntityWithAudited = new AppEntityWithAudited(entityId, "test name"); + appEntityWithAudited.SetProperty("No", 123456); + await repository.InsertAsync(appEntityWithAudited); + + using (var scope = _auditingManager.BeginScope()) + { + using (var uow = _unitOfWorkManager.Begin()) + { + var entity = await repository.GetAsync(entityId); + entity.Name = "new test name"; + + await repository.UpdateAsync(entity); + + await uow.CompleteAsync(); + } + + await scope.SaveAsync(); + } + +#pragma warning disable 4014 + _auditingStore.Received().SaveAsync(Arg.Is(x => x.EntityChanges.Count == 1 + && x.EntityChanges[0].PropertyChanges.Count == 1 + && x.EntityChanges[0].PropertyChanges[0].PropertyName == nameof(AppEntityWithAudited.Name))); #pragma warning restore 4014 } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs index 4a8c723b76..5b2e2dd226 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain.Shared/Volo/Abp/AuditLogging/AuditLogConsts.cs @@ -32,14 +32,6 @@ /// public static int MaxBrowserInfoLength { get; set; } = 512; - /// - /// Default value: 4000 - /// - public static int MaxExceptionsLength { get; set; } = 4000; - - //TODO: Replace with MaxExceptionsLength in v3.0 - public static int MaxExceptionsLengthValue { get; set; } = MaxExceptionsLength; - /// /// Default value: 256 /// diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDomainModule.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDomainModule.cs index c5e94f633a..c61fb2c855 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDomainModule.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AbpAuditLoggingDomainModule.cs @@ -1,5 +1,7 @@ using Volo.Abp.Auditing; using Volo.Abp.Domain; +using Volo.Abp.ExceptionHandling; +using Volo.Abp.Json; using Volo.Abp.Modularity; using Volo.Abp.ObjectExtending; using Volo.Abp.ObjectExtending.Modularity; @@ -10,13 +12,15 @@ namespace Volo.Abp.AuditLogging [DependsOn(typeof(AbpAuditingModule))] [DependsOn(typeof(AbpDddDomainModule))] [DependsOn(typeof(AbpAuditLoggingDomainSharedModule))] + [DependsOn(typeof(AbpExceptionHandlingModule))] + [DependsOn(typeof(AbpJsonModule))] public class AbpAuditLoggingDomainModule : AbpModule { private static readonly OneTimeRunner OneTimeRunner = new OneTimeRunner(); public override void PostConfigureServices(ServiceConfigurationContext context) { - OneTimeRunner.Run(() => + OneTimeRunner.Run(() => { ModuleExtensionConfigurationHelper.ApplyEntityConfigurationToEntity( AuditLoggingModuleExtensionConsts.ModuleName, diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs index 25e0c9d9dc..26b8b6650d 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLog.cs @@ -59,57 +59,55 @@ namespace Volo.Abp.AuditLogging } - public AuditLog(IGuidGenerator guidGenerator, AuditLogInfo auditInfo) - : base(guidGenerator.Create()) + public AuditLog( + Guid id, + string applicationName, + Guid? tenantId, + string tenantName, + Guid? userId, + string userName, + DateTime executionTime, + int executionDuration, + string clientIpAddress, + string clientName, + string clientId, + string correlationId, + string browserInfo, + string httpMethod, + string url, + int? httpStatusCode, + Guid? impersonatorUserId, + Guid? impersonatorTenantId, + ExtraPropertyDictionary extraPropertyDictionary, + List entityChanges, + List actions, + string exceptions, + string comments) + : base(id) { - ApplicationName = auditInfo.ApplicationName.Truncate(AuditLogConsts.MaxApplicationNameLength); - TenantId = auditInfo.TenantId; - TenantName = auditInfo.TenantName.Truncate(AuditLogConsts.MaxTenantNameLength); - UserId = auditInfo.UserId; - UserName = auditInfo.UserName.Truncate(AuditLogConsts.MaxUserNameLength); - ExecutionTime = auditInfo.ExecutionTime; - ExecutionDuration = auditInfo.ExecutionDuration; - ClientIpAddress = auditInfo.ClientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); - ClientName = auditInfo.ClientName.Truncate(AuditLogConsts.MaxClientNameLength); - ClientId = auditInfo.ClientId.Truncate(AuditLogConsts.MaxClientIdLength); - CorrelationId = auditInfo.CorrelationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); - BrowserInfo = auditInfo.BrowserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); - HttpMethod = auditInfo.HttpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); - Url = auditInfo.Url.Truncate(AuditLogConsts.MaxUrlLength); - HttpStatusCode = auditInfo.HttpStatusCode; - ImpersonatorUserId = auditInfo.ImpersonatorUserId; - ImpersonatorTenantId = auditInfo.ImpersonatorTenantId; - - ExtraProperties = new ExtraPropertyDictionary(); - if (auditInfo.ExtraProperties != null) - { - foreach (var pair in auditInfo.ExtraProperties) - { - ExtraProperties.Add(pair.Key, pair.Value); - } - } - - EntityChanges = auditInfo - .EntityChanges? - .Select(entityChangeInfo => new EntityChange(guidGenerator, Id, entityChangeInfo, tenantId: auditInfo.TenantId)) - .ToList() - ?? new List(); - - Actions = auditInfo - .Actions? - .Select(auditLogActionInfo => new AuditLogAction(guidGenerator.Create(), Id, auditLogActionInfo, tenantId: auditInfo.TenantId)) - .ToList() - ?? new List(); - - Exceptions = auditInfo - .Exceptions? - .JoinAsString(Environment.NewLine) - .Truncate(AuditLogConsts.MaxExceptionsLengthValue); - - Comments = auditInfo - .Comments? - .JoinAsString(Environment.NewLine) - .Truncate(AuditLogConsts.MaxCommentsLength); + ApplicationName = applicationName.Truncate(AuditLogConsts.MaxApplicationNameLength); + TenantId = tenantId; + TenantName = tenantName.Truncate(AuditLogConsts.MaxTenantNameLength); + UserId = userId; + UserName = userName.Truncate(AuditLogConsts.MaxUserNameLength); + ExecutionTime = executionTime; + ExecutionDuration = executionDuration; + ClientIpAddress = clientIpAddress.Truncate(AuditLogConsts.MaxClientIpAddressLength); + ClientName = clientName.Truncate(AuditLogConsts.MaxClientNameLength); + ClientId = clientId.Truncate(AuditLogConsts.MaxClientIdLength); + CorrelationId = correlationId.Truncate(AuditLogConsts.MaxCorrelationIdLength); + BrowserInfo = browserInfo.Truncate(AuditLogConsts.MaxBrowserInfoLength); + HttpMethod = httpMethod.Truncate(AuditLogConsts.MaxHttpMethodLength); + Url = url.Truncate(AuditLogConsts.MaxUrlLength); + HttpStatusCode = httpStatusCode; + ImpersonatorUserId = impersonatorUserId; + ImpersonatorTenantId = impersonatorTenantId; + + ExtraProperties = extraPropertyDictionary; + EntityChanges = entityChanges; + Actions = actions; + Exceptions = exceptions; + Comments = comments.Truncate(AuditLogConsts.MaxCommentsLength); } } } diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs new file mode 100644 index 0000000000..f27497324e --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditLogInfoToAuditLogConverter.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Volo.Abp.AspNetCore.ExceptionHandling; +using Volo.Abp.Auditing; +using Volo.Abp.Data; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Guids; +using Volo.Abp.Http; +using Volo.Abp.Json; + +namespace Volo.Abp.AuditLogging +{ + public class AuditLogInfoToAuditLogConverter : IAuditLogInfoToAuditLogConverter, ITransientDependency + { + protected IGuidGenerator GuidGenerator { get; } + protected IExceptionToErrorInfoConverter ExceptionToErrorInfoConverter { get; } + protected IJsonSerializer JsonSerializer { get; } + + public AuditLogInfoToAuditLogConverter(IGuidGenerator guidGenerator, IExceptionToErrorInfoConverter exceptionToErrorInfoConverter, IJsonSerializer jsonSerializer) + { + GuidGenerator = guidGenerator; + ExceptionToErrorInfoConverter = exceptionToErrorInfoConverter; + JsonSerializer = jsonSerializer; + } + + public virtual Task ConvertAsync(AuditLogInfo auditLogInfo) + { + var auditLogId = GuidGenerator.Create(); + + var extraProperties = new ExtraPropertyDictionary(); + if (auditLogInfo.ExtraProperties != null) + { + foreach (var pair in auditLogInfo.ExtraProperties) + { + extraProperties.Add(pair.Key, pair.Value); + } + } + + var entityChanges = auditLogInfo + .EntityChanges? + .Select(entityChangeInfo => new EntityChange(GuidGenerator, auditLogId, entityChangeInfo, tenantId: auditLogInfo.TenantId)) + .ToList() + ?? new List(); + + var actions = auditLogInfo + .Actions? + .Select(auditLogActionInfo => new AuditLogAction(GuidGenerator.Create(), auditLogId, auditLogActionInfo, tenantId: auditLogInfo.TenantId)) + .ToList() + ?? new List(); + + var remoteServiceErrorInfos = auditLogInfo.Exceptions?.Select(exception => ExceptionToErrorInfoConverter.Convert(exception, true)) + ?? new List(); + + var exceptions = remoteServiceErrorInfos.Any() + ? JsonSerializer.Serialize(remoteServiceErrorInfos, indented: true) + : null; + + var comments = auditLogInfo + .Comments? + .JoinAsString(Environment.NewLine); + + var auditLog = new AuditLog( + auditLogId, + auditLogInfo.ApplicationName, + auditLogInfo.TenantId, + auditLogInfo.TenantName, + auditLogInfo.UserId, + auditLogInfo.UserName, + auditLogInfo.ExecutionTime, + auditLogInfo.ExecutionDuration, + auditLogInfo.ClientIpAddress, + auditLogInfo.ClientName, + auditLogInfo.ClientId, + auditLogInfo.CorrelationId, + auditLogInfo.BrowserInfo, + auditLogInfo.HttpMethod, + auditLogInfo.Url, + auditLogInfo.HttpStatusCode, + auditLogInfo.ImpersonatorUserId, + auditLogInfo.ImpersonatorTenantId, + extraProperties, + entityChanges, + actions, + exceptions, + comments + ); + + return Task.FromResult(auditLog); + } + } +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs index f6c4343261..ccc76a4bad 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/AuditingStore.cs @@ -5,7 +5,6 @@ using Microsoft.Extensions.Logging.Abstractions; using Microsoft.Extensions.Options; using Volo.Abp.Auditing; using Volo.Abp.DependencyInjection; -using Volo.Abp.Guids; using Volo.Abp.Uow; namespace Volo.Abp.AuditLogging @@ -13,21 +12,19 @@ namespace Volo.Abp.AuditLogging public class AuditingStore : IAuditingStore, ITransientDependency { public ILogger Logger { get; set; } - protected IAuditLogRepository AuditLogRepository { get; } - protected IGuidGenerator GuidGenerator { get; } protected IUnitOfWorkManager UnitOfWorkManager { get; } protected AbpAuditingOptions Options { get; } - + protected IAuditLogInfoToAuditLogConverter Converter { get; } public AuditingStore( IAuditLogRepository auditLogRepository, - IGuidGenerator guidGenerator, IUnitOfWorkManager unitOfWorkManager, - IOptions options) + IOptions options, + IAuditLogInfoToAuditLogConverter converter) { AuditLogRepository = auditLogRepository; - GuidGenerator = guidGenerator; UnitOfWorkManager = unitOfWorkManager; + Converter = converter; Options = options.Value; Logger = NullLogger.Instance; @@ -56,9 +53,9 @@ namespace Volo.Abp.AuditLogging { using (var uow = UnitOfWorkManager.Begin(true)) { - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, auditInfo)); + await AuditLogRepository.InsertAsync(await Converter.ConvertAsync(auditInfo)); await uow.CompleteAsync(); } } } -} \ No newline at end of file +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogInfoToAuditLogConverter.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogInfoToAuditLogConverter.cs new file mode 100644 index 0000000000..faba811d4f --- /dev/null +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.Domain/Volo/Abp/AuditLogging/IAuditLogInfoToAuditLogConverter.cs @@ -0,0 +1,10 @@ +using System.Threading.Tasks; +using Volo.Abp.Auditing; + +namespace Volo.Abp.AuditLogging +{ + public interface IAuditLogInfoToAuditLogConverter + { + Task ConvertAsync(AuditLogInfo auditLogInfo); + } +} diff --git a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs index 494e4cefde..51c30ef0a1 100644 --- a/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs +++ b/modules/audit-logging/src/Volo.Abp.AuditLogging.EntityFrameworkCore/Volo/Abp/AuditLogging/EntityFrameworkCore/AbpAuditLoggingDbContextModelBuilderExtensions.cs @@ -37,9 +37,6 @@ namespace Volo.Abp.AuditLogging.EntityFrameworkCore b.Property(x => x.Url).HasMaxLength(AuditLogConsts.MaxUrlLength).HasColumnName(nameof(AuditLog.Url)); b.Property(x => x.HttpStatusCode).HasColumnName(nameof(AuditLog.HttpStatusCode)); - if (builder.IsUsingOracle()) { AuditLogConsts.MaxExceptionsLengthValue = 2000; } - b.Property(x => x.Exceptions).HasMaxLength(AuditLogConsts.MaxExceptionsLengthValue).HasColumnName(nameof(AuditLog.Exceptions)); - b.Property(x => x.Comments).HasMaxLength(AuditLogConsts.MaxCommentsLength).HasColumnName(nameof(AuditLog.Comments)); b.Property(x => x.ExecutionDuration).HasColumnName(nameof(AuditLog.ExecutionDuration)); b.Property(x => x.ImpersonatorTenantId).HasColumnName(nameof(AuditLog.ImpersonatorTenantId)); diff --git a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs index 3214ee75af..6716b87cda 100644 --- a/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs +++ b/modules/audit-logging/test/Volo.Abp.AuditLogging.TestBase/Volo/Abp/AuditLogging/AuditLogRepository_Tests.cs @@ -1,13 +1,10 @@ using System; using System.Collections.Generic; -using System.Globalization; using System.Linq; using System.Net; using System.Threading.Tasks; -using Microsoft.VisualBasic; using Shouldly; using Volo.Abp.Auditing; -using Volo.Abp.Guids; using Volo.Abp.Modularity; using Xunit; @@ -17,12 +14,12 @@ namespace Volo.Abp.AuditLogging where TStartupModule : IAbpModule { protected IAuditLogRepository AuditLogRepository { get; } - protected IGuidGenerator GuidGenerator { get; } + protected IAuditLogInfoToAuditLogConverter AuditLogInfoToAuditLogConverter { get; } protected AuditLogRepository_Tests() { AuditLogRepository = GetRequiredService(); - GuidGenerator = GetRequiredService(); + AuditLogInfoToAuditLogConverter = GetRequiredService(); } [Fact] @@ -119,8 +116,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var logs = await AuditLogRepository.GetListAsync(); @@ -223,8 +220,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var logs = await AuditLogRepository.GetCountAsync(); @@ -325,8 +322,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var date = DateTime.Parse("2020-01-01"); @@ -428,8 +425,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); @@ -534,8 +531,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityChange = @@ -641,8 +638,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var entityChangesDesc = await AuditLogRepository.GetEntityChangeListAsync(); @@ -754,8 +751,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(changeType: EntityChangeType.Created); @@ -864,8 +861,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); //Assert var entityHistory = await AuditLogRepository.GetEntityChangesWithUsernameAsync(entityId, entityType); @@ -976,8 +973,8 @@ namespace Volo.Abp.AuditLogging } }; - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log1)); - await AuditLogRepository.InsertAsync(new AuditLog(GuidGenerator, log2)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log1)); + await AuditLogRepository.InsertAsync(await AuditLogInfoToAuditLogConverter.ConvertAsync(log2)); var entityChanges = await AuditLogRepository.GetEntityChangeListAsync(); var entityHistory = diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.Designer.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.Designer.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.Designer.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.Designer.cs index 48b67399a1..060cb48e8a 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.Designer.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(MyProjectNameDbContext))] - [Migration("20210531084225_Initial")] + [Migration("20210615091011_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -20,7 +20,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("ProductVersion", "5.0.7") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => @@ -71,9 +71,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.cs similarity index 99% rename from templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.cs rename to templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.cs index af7fb7ee1b..8a02b53ba3 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210531084225_Initial.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/20210615091011_Initial.cs @@ -28,7 +28,7 @@ namespace MyCompanyName.MyProjectName.Migrations BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Exceptions = table.Column(type: "nvarchar(max)", nullable: true), Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), HttpStatusCode = table.Column(type: "int", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), diff --git a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs index 3612ae96a4..56ac0762cc 100644 --- a/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs +++ b/templates/app/aspnet-core/src/MyCompanyName.MyProjectName.EntityFrameworkCore/Migrations/MyProjectNameDbContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace MyCompanyName.MyProjectName.Migrations modelBuilder .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("ProductVersion", "5.0.7") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => @@ -69,9 +69,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.Designer.cs index 5e59d21c1c..3188e8f984 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.Designer.cs @@ -11,7 +11,7 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20210528061540_Initial")] + [Migration("20210528093547_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -71,9 +71,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.cs index c8f1e05a17..c982c31c32 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528061540_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/20210528093547_Initial.cs @@ -28,7 +28,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Exceptions = table.Column(type: "nvarchar(max)", nullable: true), Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), HttpStatusCode = table.Column(type: "int", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs index 04fcfa1d68..2d2e6dafd5 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Blazor.Server.Host/Migrations/UnifiedDbContextModelSnapshot.cs @@ -69,9 +69,7 @@ namespace MyCompanyName.MyProjectName.Blazor.Server.Host.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.Designer.cs index bda1f6108d..2a8dcb3b75 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.Designer.cs @@ -11,17 +11,17 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(IdentityServerHostMigrationsDbContext))] - [Migration("20201028014236_Initial")] + [Migration("20210528093513_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -71,9 +71,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.cs index 78dcb6359e..bf39015d0f 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20201028014236_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/20210528093513_Initial.cs @@ -28,7 +28,7 @@ namespace MyCompanyName.MyProjectName.Migrations BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Exceptions = table.Column(type: "nvarchar(max)", nullable: true), Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), HttpStatusCode = table.Column(type: "int", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs index 29deeab756..35ad1df358 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/Migrations/IdentityServerHostMigrationsDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -69,9 +69,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.Designer.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.Designer.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.Designer.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.Designer.cs index 4958727637..43912d5e1a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.Designer.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.Designer.cs @@ -11,17 +11,17 @@ using Volo.Abp.EntityFrameworkCore; namespace MyCompanyName.MyProjectName.Migrations { [DbContext(typeof(UnifiedDbContext))] - [Migration("20201028014311_Initial")] + [Migration("20210528093522_Initial")] partial class Initial { protected override void BuildTargetModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -71,9 +71,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int") diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.cs similarity index 99% rename from templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.cs rename to templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.cs index 392499da58..b5e7c7492e 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20201028014311_Initial.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/20210528093522_Initial.cs @@ -28,7 +28,7 @@ namespace MyCompanyName.MyProjectName.Migrations BrowserInfo = table.Column(type: "nvarchar(512)", maxLength: 512, nullable: true), HttpMethod = table.Column(type: "nvarchar(16)", maxLength: 16, nullable: true), Url = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), - Exceptions = table.Column(type: "nvarchar(4000)", maxLength: 4000, nullable: true), + Exceptions = table.Column(type: "nvarchar(max)", nullable: true), Comments = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: true), HttpStatusCode = table.Column(type: "int", nullable: true), ExtraProperties = table.Column(type: "nvarchar(max)", nullable: true), diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs index 7b90b1954f..bc4abaa1af 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/Migrations/UnifiedDbContextModelSnapshot.cs @@ -16,10 +16,10 @@ namespace MyCompanyName.MyProjectName.Migrations { #pragma warning disable 612, 618 modelBuilder - .UseIdentityColumns() .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.SqlServer) .HasAnnotation("Relational:MaxIdentifierLength", 128) - .HasAnnotation("ProductVersion", "5.0.0-rc.2.20475.6"); + .HasAnnotation("ProductVersion", "5.0.6") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b => { @@ -69,9 +69,7 @@ namespace MyCompanyName.MyProjectName.Migrations .HasColumnName("CorrelationId"); b.Property("Exceptions") - .HasMaxLength(4000) - .HasColumnType("nvarchar(4000)") - .HasColumnName("Exceptions"); + .HasColumnType("nvarchar(max)"); b.Property("ExecutionDuration") .HasColumnType("int")