From 409bbe6d789692eb6975a9f10d81ccaa6325383c Mon Sep 17 00:00:00 2001 From: cKey <35512826+colinin@users.noreply.github.com> Date: Thu, 9 Dec 2021 21:44:38 +0800 Subject: [PATCH] update Dockerfile --- .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../LINGYUN.Abp.Account.Web/FodyWeavers.xml | 3 + .../LINGYUN.Abp.DistributedLock.Redis.csproj | 18 - .../Redis/AbpRedisLockModule.cs | 14 - .../Redis/RedisDistributedLock.cs | 316 ------------------ .../DistributedLock/Redis/RedisLockOptions.cs | 26 -- .../LINGYUN.Abp.DistributedLock.csproj | 14 - .../DistributedLockException.cs | 14 - .../Abp/DistributedLock/IDistributedLock.cs | 61 ---- .../LINGYUN.Abp.Domain.Entities.Events.csproj | 12 - .../Events/AbpDddDomainEntitesEventsModule.cs | 10 - .../Entites/Events/EntityChangeEventHelper.cs | 151 --------- .../LINGYUN.Abp.IdentityModel/FodyWeavers.xml | 3 + .../LINGYUN.Abp.Location.Amap/FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../FodyWeavers.xml | 3 + .../Dockerfile | 2 +- .../Dockerfile | 2 +- .../Dockerfile | 2 +- .../Dockerfile | 2 +- .../Dockerfile | 2 +- .../LY.MicroService.identityServer/Dockerfile | 2 +- 27 files changed, 39 insertions(+), 642 deletions(-) create mode 100644 aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/FodyWeavers.xml create mode 100644 aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/FodyWeavers.xml create mode 100644 aspnet-core/modules/account/LINGYUN.Abp.Account.Web/FodyWeavers.xml delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN.Abp.DistributedLock.Redis.csproj delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/AbpRedisLockModule.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisDistributedLock.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisLockOptions.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/DistributedLockException.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/IDistributedLock.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs delete mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.IdentityModel/FodyWeavers.xml create mode 100644 aspnet-core/modules/common/LINGYUN.Abp.Location.Amap/FodyWeavers.xml create mode 100644 aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/FodyWeavers.xml create mode 100644 aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat/FodyWeavers.xml create mode 100644 aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/FodyWeavers.xml create mode 100644 aspnet-core/modules/localization/LINGYUN.Abp.Localization.Json/FodyWeavers.xml create mode 100644 aspnet-core/modules/message/LINGYUN.Abp.MessageService.SignalR/FodyWeavers.xml create mode 100644 aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi.Client/FodyWeavers.xml diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/FodyWeavers.xml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain.Shared/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/FodyWeavers.xml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Domain/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/FodyWeavers.xml b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/account/LINGYUN.Abp.Account.Web/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN.Abp.DistributedLock.Redis.csproj b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN.Abp.DistributedLock.Redis.csproj deleted file mode 100644 index 83ed383b3..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN.Abp.DistributedLock.Redis.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - netstandard2.0 - - 分布式锁Redis实现 - - - - - - - - - - diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/AbpRedisLockModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/AbpRedisLockModule.cs deleted file mode 100644 index 4db2f2f5e..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/AbpRedisLockModule.cs +++ /dev/null @@ -1,14 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Volo.Abp.Modularity; - -namespace LINGYUN.Abp.DistributedLock.Redis -{ - public class AbpRedisLockModule : AbpModule - { - public override void ConfigureServices(ServiceConfigurationContext context) - { - var configuration = context.Services.GetConfiguration(); - Configure(configuration.GetSection("DistributedLock:Redis")); - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisDistributedLock.cs b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisDistributedLock.cs deleted file mode 100644 index e7deeed58..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisDistributedLock.cs +++ /dev/null @@ -1,316 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Logging.Abstractions; -using Microsoft.Extensions.Options; -using Polly; -using StackExchange.Redis; -using System; -using System.Threading; -using System.Threading.Tasks; -using Volo.Abp; -using Volo.Abp.DependencyInjection; - -namespace LINGYUN.Abp.DistributedLock.Redis -{ - [ExposeServices(typeof(IDistributedLock))] - [Dependency(ServiceLifetime.Singleton, TryRegister = true)] - public class RedisDistributedLock : IDistributedLock - { - public ILogger Logger { protected get; set; } - - private volatile ConnectionMultiplexer _connection; - private IDatabase _redis; - - private readonly RedisLockOptions _options; - private readonly string _instance; - - private readonly SemaphoreSlim _connectionLock = new SemaphoreSlim(initialCount: 1, maxCount: 1); - - public RedisDistributedLock(IOptions optionsAccessor) - { - if (optionsAccessor == null) - { - throw new ArgumentNullException(nameof(optionsAccessor)); - } - - _options = optionsAccessor.Value; - - _instance = _options.InstanceName ?? string.Empty; - - Logger = NullLogger.Instance; - } - - private void RegistenConnectionEvent(ConnectionMultiplexer connection) - { - if (connection != null) - { - connection.ConnectionFailed += OnConnectionFailed; - connection.ConnectionRestored += OnConnectionRestored; - connection.ErrorMessage += OnErrorMessage; - connection.ConfigurationChanged += OnConfigurationChanged; - connection.HashSlotMoved += OnHashSlotMoved; - connection.InternalError += OnInternalError; - connection.ConfigurationChangedBroadcast += OnConfigurationChangedBroadcast; - } - } - - public bool Lock(string lockKey, string lockValue, int lockSecond = 30) - { - Connect(); - return LockTakeSync(lockKey, lockValue, TimeSpan.FromSeconds(lockSecond)); - } - - public async Task LockAsync(string lockKey, string lockValue, int lockSecond = 30, CancellationToken token = default) - { - await ConnectAsync(token); - return await LockTakeAsync(lockKey, lockValue, TimeSpan.FromSeconds(lockSecond)); - } - - public IDisposable Lock(string lockKey, int lockSecond = 30) - { - Connect(); - var redisLockToken = Environment.MachineName; - var redisLockKey = _instance + lockKey; - var lockResult = LockTakeSync(redisLockKey, redisLockToken, TimeSpan.FromSeconds(lockSecond)); - if (lockResult) - { - return new DisposeAction(() => - { - LockReleaseSync(redisLockKey, redisLockToken); - }); - } - Logger.LogWarning("Redis lock failed of key: {0}", redisLockKey); - throw new DistributedLockException(redisLockKey); - } - - public async Task LockAsync(string lockKey, int lockSecond = 30, CancellationToken token = default(CancellationToken)) - { - await ConnectAsync(token); - var redisLockToken = Environment.MachineName; - var redisLockKey = _instance + lockKey; - var lockResult = await LockTakeAsync(redisLockKey, redisLockToken, TimeSpan.FromSeconds(lockSecond)); - - if (lockResult) - { - return new DisposeAction(async () => - { - await LockReleaseAsync(redisLockKey, redisLockToken); - }); - } - Logger.LogWarning("Redis lock failed of key: {0}", redisLockKey); - throw new DistributedLockException(redisLockKey); - } - - public bool Release(string lockKey, string lockValue) - { - Connect(); - return LockReleaseSync(lockKey, lockValue); - } - - public async Task ReleaseAsync(string lockKey, string lockValue, CancellationToken token = default) - { - await ConnectAsync(token); - return await LockReleaseAsync(lockKey, lockValue); - } - /// - /// 同步加锁 - /// - /// - /// - /// - /// - protected virtual bool LockTakeSync(RedisKey key, RedisValue value, TimeSpan expiry) - { - // 定义重试策略 - var policy = Policy - .HandleResult(result => !result) - .WaitAndRetry( - retryCount: _options.FailedRetryCount, - sleepDurationProvider: sleep => TimeSpan.FromMilliseconds(_options.FailedRetryInterval), - onRetry: (result, timeSpan) => - { - Logger.LogWarning("Redis lock take failed, retry policy timeSpan:{0}", timeSpan.ToString()); - }); - // 加锁 - var lockResult = policy.Execute(() => _redis.LockTake(key, value, expiry)); - - return lockResult; - } - /// - /// 异步加锁 - /// - /// - /// - /// - /// - protected virtual async Task LockTakeAsync(RedisKey key, RedisValue value, TimeSpan expiry) - { - // 定义重试策略 - var policy = Policy - .HandleResult(result => !result) - .WaitAndRetryAsync( - retryCount: _options.FailedRetryCount, - sleepDurationProvider: sleep => TimeSpan.FromMilliseconds(_options.FailedRetryInterval), - onRetry: (result, timeSpan) => - { - Logger.LogWarning("Redis lock take failed, retry policy timeSpan:{0}", timeSpan.ToString()); - }); - // 加锁 - var lockResult = await policy.ExecuteAsync(async () => - await _redis.LockTakeAsync(key, value, expiry)); - - return lockResult; - } - /// - /// 同步释放锁 - /// - /// - /// - /// - protected virtual bool LockReleaseSync(RedisKey key, RedisValue value) - { - // 定义重试策略 - var policy = Policy - .HandleResult(result => !result) - .WaitAndRetry( - retryCount: _options.FailedRetryCount, - sleepDurationProvider: sleep => TimeSpan.FromMilliseconds(_options.FailedRetryInterval), - onRetry: (result, timeSpan) => - { - Logger.LogWarning("Redis lock release failed, retry policy timeSpan:{0}", timeSpan.ToString()); - }); - // 释放锁 - var lockReleaseResult = policy.Execute(() => _redis.LockRelease(key, value)); - - return lockReleaseResult; - } - /// - /// 异步释放锁 - /// - /// - /// - /// - protected virtual async Task LockReleaseAsync(RedisKey key, RedisValue value) - { - // 定义重试策略 - var policy = Policy - .HandleResult(result => !result) - .WaitAndRetryAsync( - retryCount: _options.FailedRetryCount, - sleepDurationProvider: sleep => TimeSpan.FromMilliseconds(_options.FailedRetryInterval), - onRetry: (result, timeSpan) => - { - Logger.LogWarning("Redis lock release failed, retry policy timeSpan:{0}", timeSpan.ToString()); - }); - // 释放锁 - var lockReleaseResult = await policy.ExecuteAsync(async () => - await _redis.LockReleaseAsync(key, value)); - - return lockReleaseResult; - } - - private void Connect() - { - if (_redis != null) - { - return; - } - - _connectionLock.Wait(); - try - { - if (_redis == null) - { - if (_options.ConfigurationOptions != null) - { - _connection = ConnectionMultiplexer.Connect(_options.ConfigurationOptions); - } - else - { - _connection = ConnectionMultiplexer.Connect(_options.Configuration); - } - RegistenConnectionEvent(_connection); - _redis = _connection.GetDatabase(); - } - } - finally - { - _connectionLock.Release(); - } - } - - - private async Task ConnectAsync(CancellationToken token = default(CancellationToken)) - { - token.ThrowIfCancellationRequested(); - - if (_redis != null) - { - return; - } - - await _connectionLock.WaitAsync(token); - try - { - if (_redis == null) - { - if (_options.ConfigurationOptions != null) - { - _connection = await ConnectionMultiplexer.ConnectAsync(_options.ConfigurationOptions); - } - else - { - _connection = await ConnectionMultiplexer.ConnectAsync(_options.Configuration); - } - RegistenConnectionEvent(_connection); - _redis = _connection.GetDatabase(); - } - } - finally - { - _connectionLock.Release(); - } - } - - private void OnConfigurationChangedBroadcast(object sender, EndPointEventArgs e) - { - Logger.LogInformation("Redis lock server master/slave changes"); - } - - private void OnInternalError(object sender, InternalErrorEventArgs e) - { - Logger.LogError("Redis lock internal error, origin:{0}, connectionType:{1}", - e.Origin, e.ConnectionType); - Logger.LogError(e.Exception, "Redis lock internal error"); - - } - - private void OnHashSlotMoved(object sender, HashSlotMovedEventArgs e) - { - Logger.LogInformation("Redis lock configuration changed"); - } - - private void OnConfigurationChanged(object sender, EndPointEventArgs e) - { - Logger.LogInformation("Redis lock configuration changed"); - } - - private void OnErrorMessage(object sender, RedisErrorEventArgs e) - { - Logger.LogWarning("Redis lock error, message:{0}", e.Message); - } - - private void OnConnectionRestored(object sender, ConnectionFailedEventArgs e) - { - Logger.LogWarning("Redis lock connection restored, failureType:{0}, connectionType:{1}", - e.FailureType, e.ConnectionType); - } - - private void OnConnectionFailed(object sender, ConnectionFailedEventArgs e) - { - Logger.LogError("Redis lock connection failed, failureType:{0}, connectionType:{1}", - e.FailureType, e.ConnectionType); - Logger.LogError(e.Exception, "Redis lock connection failed"); - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisLockOptions.cs b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisLockOptions.cs deleted file mode 100644 index 1a60340be..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock.Redis/LINGYUN/Abp/DistributedLock/Redis/RedisLockOptions.cs +++ /dev/null @@ -1,26 +0,0 @@ -using Microsoft.Extensions.Options; -using StackExchange.Redis; - -namespace LINGYUN.Abp.DistributedLock.Redis -{ - public class RedisLockOptions : IOptions - { - public string Configuration { get; set; } - public ConfigurationOptions ConfigurationOptions { get; set; } - public string InstanceName { get; set; } - /// - /// 失败重试次数 - /// default: 3 - /// - public int FailedRetryCount { get; set; } = 3; - /// - /// 失败重试间隔 ms - /// default: 1000 - /// - public int FailedRetryInterval { get; set; } = 1000; - RedisLockOptions IOptions.Value - { - get { return this; } - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj deleted file mode 100644 index 989fe915b..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN.Abp.DistributedLock.csproj +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - netstandard2.0 - - - - - - - - diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/DistributedLockException.cs b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/DistributedLockException.cs deleted file mode 100644 index 2a9e045e2..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/DistributedLockException.cs +++ /dev/null @@ -1,14 +0,0 @@ -using LINGYUN.Abp.ExceptionHandling; -using System; - -namespace LINGYUN.Abp.DistributedLock -{ - public class DistributedLockException : Exception, IHasNotifierErrorMessage - { - public DistributedLockException(string message) - : base(message) - { - - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/IDistributedLock.cs b/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/IDistributedLock.cs deleted file mode 100644 index 3b1b1d864..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.DistributedLock/LINGYUN/Abp/DistributedLock/IDistributedLock.cs +++ /dev/null @@ -1,61 +0,0 @@ -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace LINGYUN.Abp.DistributedLock -{ - /// - /// 分布式锁接口 - /// - public interface IDistributedLock - { - /// - /// 分布式锁 - /// 需要手动释放锁 - /// - /// 锁键名 - /// 锁定对象 - /// 锁定时间(秒) - /// - bool Lock(string lockKey, string lockValue, int lockSecond = 30); - /// - /// 分布式锁 - /// using块自动释放锁 - /// - /// 锁键名 - /// 锁定时间(秒) - /// - IDisposable Lock(string lockKey, int lockSecond = 30); - /// - /// 分布式锁 - /// using块自动释放锁 - /// - /// 锁键名 - /// 锁定时间(秒) - /// - Task LockAsync(string lockKey, int lockSecond = 30, CancellationToken token = default(CancellationToken)); - /// - /// 分布式锁 - /// 需要手动释放锁 - /// - /// 锁键名 - /// 锁定对象 - /// 锁定时间(秒) - /// - Task LockAsync(string lockKey, string lockValue, int lockSecond = 30, CancellationToken token = default(CancellationToken)); - /// - /// 释放锁资源 - /// - /// 锁键名 - /// 锁定对象 - /// - bool Release(string lockKey, string lockValue); - /// - /// 释放锁资源 - /// - /// 锁键名 - /// 锁定对象 - /// - Task ReleaseAsync(string lockKey, string lockValue, CancellationToken token = default(CancellationToken)); - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj deleted file mode 100644 index 9c0cfca13..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN.Abp.Domain.Entities.Events.csproj +++ /dev/null @@ -1,12 +0,0 @@ - - - - netstandard2.0 - - - - - - - - diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs deleted file mode 100644 index 1e58ef752..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/AbpDddDomainEntitesEventsModule.cs +++ /dev/null @@ -1,10 +0,0 @@ -using Volo.Abp.Domain; -using Volo.Abp.Modularity; - -namespace LINGYUN.Abp.Domain.Entities.Events -{ - [DependsOn(typeof(AbpDddDomainModule))] - public class AbpDddDomainEntitesEventsModule : AbpModule - { - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs b/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs deleted file mode 100644 index 69d29eee0..000000000 --- a/aspnet-core/modules/common/LINGYUN.Abp.Domain.Entities.Events/LINGYUN/Abp/Domain/Entites/Events/EntityChangeEventHelper.cs +++ /dev/null @@ -1,151 +0,0 @@ -using Microsoft.Extensions.Logging; -using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Volo.Abp.DependencyInjection; -using Volo.Abp.Domain.Entities; -using Volo.Abp.Domain.Entities.Events; -using Volo.Abp.Domain.Entities.Events.Distributed; -using Volo.Abp.DynamicProxy; -using Volo.Abp.EventBus; -using Volo.Abp.Uow; - -namespace LINGYUN.Abp.Domain.Entities.Events -{ - [Dependency(Microsoft.Extensions.DependencyInjection.ServiceLifetime.Transient, ReplaceServices = true)] - [ExposeServices(typeof(IEntityChangeEventHelper), typeof(Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper))] - [Obsolete("the component will be removed when the abp framework is upgraded to 3.1.0")] - public class EntityChangeEventHelper : Volo.Abp.Domain.Entities.Events.EntityChangeEventHelper - { - public EntityChangeEventHelper( - IUnitOfWorkManager unitOfWorkManager, - IEntityToEtoMapper entityToEtoMapper, - IOptions distributedEntityEventOptions) - : base(unitOfWorkManager, entityToEtoMapper, distributedEntityEventOptions) - { - } - - protected override async Task TriggerEventWithEntity( - IEventBus eventPublisher, - Type genericEventType, - object entityOrEto, - object originalEntity, - bool triggerInCurrentUnitOfWork) - { - var entityType = ProxyHelper.UnProxy(entityOrEto).GetType(); - var eventType = genericEventType.MakeGenericType(entityType); - var currentUow = UnitOfWorkManager.Current; - - if (triggerInCurrentUnitOfWork || currentUow == null) - { - await eventPublisher.PublishAsync( - eventType, - Activator.CreateInstance(eventType, entityOrEto) - ); - - return; - } - - var eventList = GetEventList(currentUow); - var isFirstEvent = !eventList.Any(); - - eventList.AddUniqueEvent(eventPublisher, eventType, entityOrEto, originalEntity); - - /* Register to OnCompleted if this is the first item. - * Other items will already be in the list once the UOW completes. - */ - if (isFirstEvent) - { - currentUow.OnCompleted( - async () => - { - foreach (var eventEntry in eventList) - { - try - { - // TODO: abp.io 3.1修复 - await eventEntry.EventBus.PublishAsync( - eventEntry.EventType, - Activator.CreateInstance(eventEntry.EventType, eventEntry.EntityOrEto) - ); - } - catch (Exception ex) - { - Logger.LogError( - $"Caught an exception while publishing the event '{eventType.FullName}' for the entity '{entityOrEto}'"); - Logger.LogException(ex); - } - } - } - ); - } - } - - private EntityChangeEventList GetEventList(IUnitOfWork currentUow) - { - return (EntityChangeEventList)currentUow.Items.GetOrAdd( - "AbpEntityChangeEventList", - () => new EntityChangeEventList() - ); - } - - private class EntityChangeEventList : List - { - public void AddUniqueEvent(IEventBus eventBus, Type eventType, object entityOrEto, object originalEntity) - { - var newEntry = new EntityChangeEventEntry(eventBus, eventType, entityOrEto, originalEntity); - - //Latest "same" event overrides the previous events. - for (var i = 0; i < Count; i++) - { - if (this[i].IsSameEvent(newEntry)) - { - this[i] = newEntry; - return; - } - } - - //If this is a "new" event, add to the end - Add(newEntry); - } - } - - private class EntityChangeEventEntry - { - public IEventBus EventBus { get; } - - public Type EventType { get; } - - public object EntityOrEto { get; } - - public object OriginalEntity { get; } - - public EntityChangeEventEntry(IEventBus eventBus, Type eventType, object entityOrEto, object originalEntity) - { - EventType = eventType; - EntityOrEto = entityOrEto; - OriginalEntity = originalEntity; - EventBus = eventBus; - } - - public bool IsSameEvent(EntityChangeEventEntry otherEntry) - { - if (EventBus != otherEntry.EventBus || EventType != otherEntry.EventType) - { - return false; - } - - var originalEntityRef = OriginalEntity as IEntity; - var otherOriginalEntityRef = otherEntry.OriginalEntity as IEntity; - if (originalEntityRef == null || otherOriginalEntityRef == null) - { - return false; - } - - return EntityHelper.EntityEquals(originalEntityRef, otherOriginalEntityRef); - } - } - } -} diff --git a/aspnet-core/modules/common/LINGYUN.Abp.IdentityModel/FodyWeavers.xml b/aspnet-core/modules/common/LINGYUN.Abp.IdentityModel/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.IdentityModel/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Location.Amap/FodyWeavers.xml b/aspnet-core/modules/common/LINGYUN.Abp.Location.Amap/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/common/LINGYUN.Abp.Location.Amap/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/FodyWeavers.xml b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.SmsValidator/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat/FodyWeavers.xml b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/identityServer/LINGYUN.Abp.IdentityServer.WeChat/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/FodyWeavers.xml b/aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/localization/LINGYUN.Abp.Localization.CultureMap/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/localization/LINGYUN.Abp.Localization.Json/FodyWeavers.xml b/aspnet-core/modules/localization/LINGYUN.Abp.Localization.Json/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/localization/LINGYUN.Abp.Localization.Json/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/message/LINGYUN.Abp.MessageService.SignalR/FodyWeavers.xml b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.SignalR/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/message/LINGYUN.Abp.MessageService.SignalR/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi.Client/FodyWeavers.xml b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi.Client/FodyWeavers.xml new file mode 100644 index 000000000..1715698cc --- /dev/null +++ b/aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.HttpApi.Client/FodyWeavers.xml @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Dockerfile b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Dockerfile index 5ecc3ca3f..c5f093013 100644 --- a/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Dockerfile +++ b/aspnet-core/services/LY.MicroService.BackendAdmin.HttpApi.Host/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app diff --git a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Dockerfile b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Dockerfile index 642e1370e..87255cca0 100644 --- a/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Dockerfile +++ b/aspnet-core/services/LY.MicroService.LocalizationManagement.HttpApi.Host/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app diff --git a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Dockerfile b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Dockerfile index 7b4de0832..269c8548d 100644 --- a/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Dockerfile +++ b/aspnet-core/services/LY.MicroService.PlatformManagement.HttpApi.Host/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app diff --git a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Dockerfile b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Dockerfile index 6e1f512de..7da73331e 100644 --- a/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Dockerfile +++ b/aspnet-core/services/LY.MicroService.RealtimeMessage.HttpApi.Host/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app diff --git a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Dockerfile b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Dockerfile index 88275f9bc..6b907d83d 100644 --- a/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Dockerfile +++ b/aspnet-core/services/LY.MicroService.identityServer.HttpApi.Host/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app diff --git a/aspnet-core/services/LY.MicroService.identityServer/Dockerfile b/aspnet-core/services/LY.MicroService.identityServer/Dockerfile index cad1c1829..0e5e78257 100644 --- a/aspnet-core/services/LY.MicroService.identityServer/Dockerfile +++ b/aspnet-core/services/LY.MicroService.identityServer/Dockerfile @@ -1,4 +1,4 @@ -FROM mcr.microsoft.com/dotnet/aspnet:5.0 +FROM mcr.microsoft.com/dotnet/aspnet:6.0 LABEL maintainer="colin.in@foxmail.com" WORKDIR /app