diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs
index 707833e2c..eac41eff1 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobNamingNormalizer.cs
@@ -6,6 +6,12 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
{
public class AliyunBlobNamingNormalizer : IBlobNamingNormalizer, ITransientDependency
{
+ ///
+ /// 阿里云对象命名规范
+ /// https://help.aliyun.com/document_detail/31827.html?spm=a2c4g.11186623.6.607.37b332eaM3NKzY
+ ///
+ ///
+ ///
public virtual string NormalizeBlobName(string blobName)
{
return blobName;
@@ -15,7 +21,7 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
/// 阿里云BucketName命名规范
/// https://help.aliyun.com/document_detail/31885.html?spm=a2c4g.11186623.6.583.56081c62w6meOR
///
- ///
+ ///
///
public virtual string NormalizeContainerName(string containerName)
{
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs
index f3ca59687..8499ae806 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Aliyun/LINGYUN/Abp/BlobStoring/Aliyun/AliyunBlobProvider.cs
@@ -55,8 +55,9 @@ namespace LINGYUN.Abp.BlobStoring.Aliyun
var ossClient = GetOssClient(args);
var ossObject = ossClient.GetObject(GetBucketName(args), blobName);
- // 返回原始结果才会调用 Stream.ReadAsync();
- return ossObject.Content;
+ var memoryStream = new MemoryStream();
+ await ossObject.Content.CopyToAsync(memoryStream);
+ return memoryStream;
}
public override async Task SaveAsync(BlobProviderSaveArgs args)
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN.Abp.BlobStoring.Qiniu.csproj b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN.Abp.BlobStoring.Qiniu.csproj
deleted file mode 100644
index 6357ced54..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN.Abp.BlobStoring.Qiniu.csproj
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
- netstandard2.0
- true
- 3.0.0
- LINGYUN
- 七牛云Oss对象存储Abp集成
-
-
-
- D:\LocalNuget
-
-
-
-
-
-
-
-
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/AbpBlobStoringQiniuModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/AbpBlobStoringQiniuModule.cs
deleted file mode 100644
index 8631fb6a8..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/AbpBlobStoringQiniuModule.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-using System;
-using Volo.Abp.BlobStoring;
-using Volo.Abp.Modularity;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- [DependsOn(typeof(AbpBlobStoringModule))]
- public class AbpBlobStoringQiniuModule : AbpModule
- {
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/DefaultQiniuBlobNameCalculator.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/DefaultQiniuBlobNameCalculator.cs
deleted file mode 100644
index 7d49d0548..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/DefaultQiniuBlobNameCalculator.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-using Volo.Abp.BlobStoring;
-using Volo.Abp.DependencyInjection;
-using Volo.Abp.MultiTenancy;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public class DefaultQiniuBlobNameCalculator : IQiniuBlobNameCalculator, ITransientDependency
- {
- protected ICurrentTenant CurrentTenant { get; }
-
- public DefaultQiniuBlobNameCalculator(
- ICurrentTenant currentTenant)
- {
- CurrentTenant = currentTenant;
- }
-
- public string Calculate(BlobProviderArgs args)
- {
- return CurrentTenant.Id == null
- ? $"host/{args.BlobName}"
- : $"tenants/{CurrentTenant.Id.Value:D}/{args.BlobName}";
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/IQiniuBlobNameCalculator.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/IQiniuBlobNameCalculator.cs
deleted file mode 100644
index e58ba7b4b..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/IQiniuBlobNameCalculator.cs
+++ /dev/null
@@ -1,9 +0,0 @@
-using Volo.Abp.BlobStoring;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public interface IQiniuBlobNameCalculator
- {
- string Calculate(BlobProviderArgs args);
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobContainerConfigurationExtensions.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobContainerConfigurationExtensions.cs
deleted file mode 100644
index c3b562c67..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobContainerConfigurationExtensions.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-using Volo.Abp.BlobStoring;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public static class QiniuBlobContainerConfigurationExtensions
- {
- public static QiniuBlobProviderConfiguration GetQiniuConfiguration(
- this BlobContainerConfiguration containerConfiguration)
- {
- return new QiniuBlobProviderConfiguration(containerConfiguration);
- }
-
- public static BlobContainerConfiguration UseQiniu(
- this BlobContainerConfiguration containerConfiguration,
- Action qiniuConfigureAction)
- {
- containerConfiguration.ProviderType = typeof(QiniuBlobProvider);
-
- qiniuConfigureAction(new QiniuBlobProviderConfiguration(containerConfiguration));
-
- return containerConfiguration;
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProvider.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProvider.cs
deleted file mode 100644
index 0b9d2f4c9..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProvider.cs
+++ /dev/null
@@ -1,50 +0,0 @@
-using Qiniu.Util;
-using System;
-using System.IO;
-using System.Threading.Tasks;
-using Volo.Abp.BlobStoring;
-using Volo.Abp.DependencyInjection;
-using QiniuConfig = Qiniu.Common.Config;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public class QiniuBlobProvider : BlobProviderBase, ITransientDependency
- {
- protected IQiniuBlobNameCalculator QiniuBlobNameCalculator { get; }
- public override Task DeleteAsync(BlobProviderDeleteArgs args)
- {
- throw new NotImplementedException();
- }
-
- public override Task ExistsAsync(BlobProviderExistsArgs args)
- {
- throw new NotImplementedException();
- }
-
- public override Task GetOrNullAsync(BlobProviderGetArgs args)
- {
- throw new NotImplementedException();
- }
-
- public override Task SaveAsync(BlobProviderSaveArgs args)
- {
- throw new NotImplementedException();
- }
-
- private Mac GetMac(BlobProviderArgs args)
- {
- var configuration = args.Configuration.GetQiniuConfiguration();
- return new Mac(configuration.AccessKey, configuration.SecretKey);
- }
-
- private string GetAndInitBucketName(BlobProviderArgs args)
- {
- var configuration = args.Configuration.GetQiniuConfiguration();
- var bucketName = configuration.BucketName.IsNullOrWhiteSpace()
- ? args.ContainerName
- : configuration.BucketName;
- QiniuConfig.AutoZone(configuration.AccessKey, bucketName, true);
- return bucketName;
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfiguration.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfiguration.cs
deleted file mode 100644
index 2a2941291..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfiguration.cs
+++ /dev/null
@@ -1,85 +0,0 @@
-using Volo.Abp;
-using Volo.Abp.BlobStoring;
-
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public class QiniuBlobProviderConfiguration
- {
- ///
- /// Api授权码
- ///
- public string AccessKey
- {
- get => _containerConfiguration.GetConfiguration(QiniuBlobProviderConfigurationNames.AccessKey);
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.AccessKey, Check.NotNullOrWhiteSpace(value, nameof(value)));
- }
- ///
- /// Api密钥
- ///
- public string SecretKey
- {
- get => _containerConfiguration.GetConfiguration(QiniuBlobProviderConfigurationNames.SecretKey);
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.SecretKey, Check.NotNullOrWhiteSpace(value, nameof(value)));
- }
- ///
- /// 默认的Bucket名称
- ///
- public string BucketName
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.BucketName, "");
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.BucketName, value ?? "");
- }
- ///
- /// 默认自动删除该文件天数
- /// 默认 0,不删除
- ///
- public int DeleteAfterDays
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.DeleteAfterDays, 0);
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.DeleteAfterDays, value);
- }
- ///
- /// 上传成功后,七牛云向业务服务器发送 POST 请求的 URL。
- /// 必须是公网上可以正常进行 POST 请求并能响应 HTTP/1.1 200 OK 的有效 URL
- ///
- public string UploadCallbackUrl
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.UploadCallbackUrl, "");
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.UploadCallbackUrl, value ?? "");
- }
- ///
- /// 上传成功后,七牛云向业务服务器发送回调通知时的 Host 值。
- /// 与 callbackUrl 配合使用,仅当设置了 callbackUrl 时才有效。
- ///
- public string UploadCallbackHost
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.UploadCallbackHost, "");
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.UploadCallbackHost, value ?? "");
- }
- ///
- /// 上传成功后,七牛云向业务服务器发送回调通知 callbackBody 的 Content-Type。
- /// 默认为 application/x-www-form-urlencoded,也可设置为 application/json。
- ///
- public string UploadCallbackBodyType
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.UploadCallbackBodyType, "");
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.UploadCallbackBodyType, value ?? "");
- }
- ///
- /// 上传成功后,自定义七牛云最终返回給上传端(在指定 returnUrl 时是携带在跳转路径参数中)的数据。
- /// 支持魔法变量和自定义变量。returnBody 要求是合法的 JSON 文本。
- /// 例如 {"key": $(key), "hash": $(etag), "w": $(imageInfo.width), "h": $(imageInfo.height)}。
- ///
- public string UploadCallbackBody
- {
- get => _containerConfiguration.GetConfigurationOrDefault(QiniuBlobProviderConfigurationNames.UploadCallbackBody, "");
- set => _containerConfiguration.SetConfiguration(QiniuBlobProviderConfigurationNames.UploadCallbackBody, value ?? "");
- }
- private readonly BlobContainerConfiguration _containerConfiguration;
-
- public QiniuBlobProviderConfiguration(BlobContainerConfiguration containerConfiguration)
- {
- _containerConfiguration = containerConfiguration;
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfigurationNames.cs b/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfigurationNames.cs
deleted file mode 100644
index ade594564..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.BlobStoring.Qiniu/LINGYUN/Abp/BlobStoring/Qiniu/QiniuBlobProviderConfigurationNames.cs
+++ /dev/null
@@ -1,44 +0,0 @@
-namespace LINGYUN.Abp.BlobStoring.Qiniu
-{
- public static class QiniuBlobProviderConfigurationNames
- {
- ///
- /// Api授权码
- ///
- public const string AccessKey = "Qiniu:OSS:AccessKey";
- ///
- /// Api密钥
- ///
- public const string SecretKey = "Qiniu:OSS:SecretKey";
- ///
- /// 默认的Bucket名称
- ///
- public const string BucketName = "Qiniu:OSS:BucketName";
- ///
- /// 默认自动删除该文件天数
- /// 默认 0,不删除
- ///
- public const string DeleteAfterDays = "Qiniu:OSS:DeleteAfterDays";
- ///
- /// 上传成功后,七牛云向业务服务器发送 POST 请求的 URL。
- /// 必须是公网上可以正常进行 POST 请求并能响应 HTTP/1.1 200 OK 的有效 URL
- ///
- public const string UploadCallbackUrl = "Qiniu:OSS:UploadCallbackUrl";
- ///
- /// 上传成功后,七牛云向业务服务器发送回调通知时的 Host 值。
- /// 与 callbackUrl 配合使用,仅当设置了 callbackUrl 时才有效。
- ///
- public const string UploadCallbackHost = "Qiniu:OSS:UploadCallbackHost";
- ///
- /// 上传成功后,七牛云向业务服务器发送回调通知 callbackBody 的 Content-Type。
- /// 默认为 application/x-www-form-urlencoded,也可设置为 application/json。
- ///
- public const string UploadCallbackBodyType = "Qiniu:OSS:UploadCallbackBodyType";
- ///
- /// 上传成功后,自定义七牛云最终返回給上传端(在指定 returnUrl 时是携带在跳转路径参数中)的数据。
- /// 支持魔法变量和自定义变量。returnBody 要求是合法的 JSON 文本。
- /// 例如 {"key": $(key), "hash": $(etag), "w": $(imageInfo.width), "h": $(imageInfo.height)}。
- ///
- public const string UploadCallbackBody = "Qiniu:OSS:UploadCallbackBody";
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN.Abp.Identity.OverrideOptions.csproj b/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN.Abp.Identity.OverrideOptions.csproj
deleted file mode 100644
index 5c687d60f..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN.Abp.Identity.OverrideOptions.csproj
+++ /dev/null
@@ -1,18 +0,0 @@
-
-
-
- netstandard2.0
-
- true
- 3.0.0
-
-
-
- D:\LocalNuget
-
-
-
-
-
-
-
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsFactory.cs b/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsFactory.cs
deleted file mode 100644
index db3789797..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsFactory.cs
+++ /dev/null
@@ -1,77 +0,0 @@
-using Microsoft.AspNetCore.Identity;
-using Microsoft.Extensions.Options;
-using System;
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Volo.Abp.Identity.Settings;
-using Volo.Abp.Options;
-using Volo.Abp.Settings;
-using Volo.Abp.Threading;
-
-namespace LINGYUN.Abp.Identity
-{
- public class AbpIdentityOverrideOptionsFactory : AbpOptionsFactory
- {
- protected ISettingStore SettingStore { get; }
- public AbpIdentityOverrideOptionsFactory(
- ISettingStore settingStore,
- IEnumerable> setups,
- IEnumerable> postConfigures)
- : base(setups, postConfigures)
- {
- SettingStore = settingStore;
- }
-
- public override IdentityOptions Create(string name)
- {
- var options = base.Create(name);
-
- // 重写为只获取公共配置
- OverrideOptions(options);
-
- return options;
- }
-
- protected virtual void OverrideOptions(IdentityOptions options)
- {
- AsyncHelper.RunSync(() => OverrideOptionsAsync(options));
- }
-
- protected virtual async Task OverrideOptionsAsync(IdentityOptions options)
- {
- options.Password.RequiredLength = await GetOrDefaultAsync(IdentitySettingNames.Password.RequiredLength, options.Password.RequiredLength);
- options.Password.RequiredUniqueChars = await GetOrDefaultAsync(IdentitySettingNames.Password.RequiredUniqueChars, options.Password.RequiredUniqueChars);
- options.Password.RequireNonAlphanumeric = await GetOrDefaultAsync(IdentitySettingNames.Password.RequireNonAlphanumeric, options.Password.RequireNonAlphanumeric);
- options.Password.RequireLowercase = await GetOrDefaultAsync(IdentitySettingNames.Password.RequireLowercase, options.Password.RequireLowercase);
- options.Password.RequireUppercase = await GetOrDefaultAsync(IdentitySettingNames.Password.RequireUppercase, options.Password.RequireUppercase);
- options.Password.RequireDigit = await GetOrDefaultAsync(IdentitySettingNames.Password.RequireDigit, options.Password.RequireDigit);
-
- options.Lockout.AllowedForNewUsers = await GetOrDefaultAsync(IdentitySettingNames.Lockout.AllowedForNewUsers, options.Lockout.AllowedForNewUsers);
- options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromSeconds(await GetOrDefaultAsync(IdentitySettingNames.Lockout.LockoutDuration, options.Lockout.DefaultLockoutTimeSpan.TotalSeconds.To()));
- options.Lockout.MaxFailedAccessAttempts = await GetOrDefaultAsync(IdentitySettingNames.Lockout.MaxFailedAccessAttempts, options.Lockout.MaxFailedAccessAttempts);
-
- options.SignIn.RequireConfirmedEmail = await GetOrDefaultAsync(IdentitySettingNames.SignIn.RequireConfirmedEmail, options.SignIn.RequireConfirmedEmail);
- options.SignIn.RequireConfirmedPhoneNumber = await GetOrDefaultAsync(IdentitySettingNames.SignIn.RequireConfirmedPhoneNumber, options.SignIn.RequireConfirmedPhoneNumber);
- }
-
- protected virtual async Task GetOrDefaultAsync(string name, T defaultValue = default(T)) where T : struct
- {
- var setting = await SettingStore.GetOrNullAsync(name, GlobalSettingValueProvider.ProviderName, null);
- if (setting.IsNullOrWhiteSpace())
- {
- return defaultValue;
- }
- return setting.To();
- }
-
- protected virtual async Task GetOrDefaultAsync(string name, string defaultValue = "")
- {
- var setting = await SettingStore.GetOrNullAsync(name, GlobalSettingValueProvider.ProviderName, null);
- if (setting.IsNullOrWhiteSpace())
- {
- return defaultValue;
- }
- return setting;
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsModule.cs b/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsModule.cs
deleted file mode 100644
index 798c469a2..000000000
--- a/aspnet-core/modules/common/LINGYUN.Abp.Identity.OverrideOptions/LINGYUN/Abp/Identity/AbpIdentityOverrideOptionsModule.cs
+++ /dev/null
@@ -1,37 +0,0 @@
-using Microsoft.AspNetCore.Identity;
-using Microsoft.Extensions.Configuration;
-using Microsoft.Extensions.DependencyInjection;
-using Microsoft.Extensions.DependencyInjection.Extensions;
-using Microsoft.Extensions.Options;
-using System;
-using Volo.Abp.Identity;
-using Volo.Abp.Modularity;
-
-namespace LINGYUN.Abp.Identity
-{
- ///
- /// 重写IdentityOptions,主要替换配置工厂组件,不再从SettingProvider获取IdentityOptions配置
- /// 在跨服务器时,从SettingProvider获取配置,用户需等待很长的时间,严重影响体验
- /// 如果是本地服务器,可以忽略这些性能影响,不需要引用此模块
- ///
- [DependsOn(typeof(AbpIdentityDomainModule))]
- public class AbpIdentityOverrideOptionsModule : AbpModule
- {
- public override void ConfigureServices(ServiceConfigurationContext context)
- {
- // TODO:配置文件指定IdentityOptions,避免从数据库读取的超长时间等待
- // 问题点:https://github.com/abpframework/abp/blob/dev/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/AbpIdentityOptionsFactory.cs
- // 有11个同步等待任务去获取身份认证配置,如果缓存不存在,会执行11条数据库指令
- // 运行过程中严重影响体验
- context.Services.Replace(ServiceDescriptor.Transient, AbpIdentityOverrideOptionsFactory>());
- context.Services.Replace(ServiceDescriptor.Transient, OptionsManager>());
-
- var configuration = context.Services.GetConfiguration();
- Configure(configuration.GetSection("Identity"));
- Configure(options =>
- {
- options.Lockout.DefaultLockoutTimeSpan = TimeSpan.FromSeconds(configuration.GetSection("Identity:Lockout:LockoutDuration").Get());
- });
- }
- }
-}
diff --git a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs
index 3548976f2..f27df960c 100644
--- a/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs
+++ b/aspnet-core/modules/common/LINGYUN.Abp.Notifications/LINGYUN/Abp/Notifications/Internal/DefaultNotificationDispatcher.cs
@@ -190,7 +190,7 @@ namespace LINGYUN.Abp.Notifications.Internal
{
Logger.LogDebug($"Sending notification with provider {provider.Name}");
var notifacationDataMapping = _notificationOptions.NotificationDataMappings
- .GetMapItemOrNull(provider.Name, notificationInfo.CateGory);
+ .GetMapItemOrNull(notificationInfo.CateGory, provider.Name);
if (notifacationDataMapping != null)
{
notificationInfo.Data = notifacationDataMapping.MappingFunc(notificationInfo.Data);
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj
index ffa1b08ed..a6dcf80a1 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN.Platform.Application.Contracts.csproj
@@ -13,6 +13,16 @@
D:\LocalNuget
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs
new file mode 100644
index 000000000..f52cdc6ac
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/AppPlatformApplicationContractModule.cs
@@ -0,0 +1,27 @@
+using LINGYUN.Platform.Localization;
+using Volo.Abp.Localization;
+using Volo.Abp.Modularity;
+using Volo.Abp.VirtualFileSystem;
+
+namespace LINGYUN.Platform
+{
+ [DependsOn(typeof(AppPlatformDomainSharedModule))]
+ public class AppPlatformApplicationContractModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options =>
+ {
+ options.FileSets.AddEmbedded();
+ });
+
+ Configure(options =>
+ {
+ options.Resources
+ .Get()
+ .AddVirtualJson("/LINGYUN/Platform/Localization/ApplicationContracts");
+ });
+
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json
new file mode 100644
index 000000000..cc5a6e73b
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/en.json
@@ -0,0 +1,22 @@
+{
+ "culture": "en",
+ "texts": {
+ "Permission:Platform": "Platform service",
+ "Permission:AppVersion": "Version management",
+ "Permission:FileSystem": "File system",
+ "Permission:FileManager": "File management",
+ "Permission:CreateVersion": "Create version",
+ "Permission:DeleteVersion": "Delete version",
+ "Permission:CreateFolder": "Create directory",
+ "Permission:DeleteFolder": "Delete directory",
+ "Permission:RenameFolder": "Directory rename",
+ "Permission:MoveFolder": "Change directory",
+ "Permission:CopyFolder": "Copy directory",
+ "Permission:AppendFile": "Add files",
+ "Permission:UpdateFile": "Change file",
+ "Permission:DeleteFile": "Delete file",
+ "Permission:CopyFile": "Copy file",
+ "Permission:MoveFile": "Move file",
+ "Permission:DownloadFile": "Download file"
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json
new file mode 100644
index 000000000..865c16411
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Localization/ApplicationContracts/zh-Hans.json
@@ -0,0 +1,22 @@
+{
+ "culture": "zh-Hans",
+ "texts": {
+ "Permission:Platform": "平台服务",
+ "Permission:AppVersion": "版本管理",
+ "Permission:FileSystem": "文件系统",
+ "Permission:FileManager": "文件管理",
+ "Permission:CreateVersion": "创建版本",
+ "Permission:DeleteVersion": "删除版本",
+ "Permission:CreateFolder": "创建目录",
+ "Permission:DeleteFolder": "删除目录",
+ "Permission:RenameFolder": "目录改名",
+ "Permission:MoveFolder": "变更目录",
+ "Permission:CopyFolder": "复制目录",
+ "Permission:AppendFile": "添加文件",
+ "Permission:UpdateFile": "变更文件",
+ "Permission:DeleteFile": "删除文件",
+ "Permission:CopyFile": "复制文件",
+ "Permission:MoveFile": "移动文件",
+ "Permission:DownloadFile": "下载文件"
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs
new file mode 100644
index 000000000..7a06e6b78
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissionDefinitionProvider.cs
@@ -0,0 +1,45 @@
+using LINGYUN.Platform.Localization;
+using Volo.Abp.Authorization.Permissions;
+using Volo.Abp.Localization;
+
+namespace LINGYUN.Platform.Permissions
+{
+ public class PlatformPermissionDefinitionProvider : PermissionDefinitionProvider
+ {
+ public override void Define(IPermissionDefinitionContext context)
+ {
+ var platform = context.AddGroup(PlatformPermissions.GroupName, L("Permission:Platform"));
+
+ var appVersion = platform.AddPermission(PlatformPermissions.AppVersion.Default, L("Permission:AppVersion"));
+ appVersion.AddChild(PlatformPermissions.AppVersion.Create, L("Permission:CreateVersion"));
+ appVersion.AddChild(PlatformPermissions.AppVersion.Delete, L("Permission:DeleteVersion"));
+
+ var versionFile = appVersion.AddChild(PlatformPermissions.AppVersion.FileManager.Default, L("Permission:FileManager"));
+ versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Create, L("Permission:AppendFile"));
+ versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Delete, L("Permission:DeleteFile"));
+ versionFile.AddChild(PlatformPermissions.AppVersion.FileManager.Download, L("Permission:DownloadFile"));
+
+ // TODO: 2020-07-27 目前abp不支持对象存储管理(或者属于企业版?)需要创建一个 LINGYUN.Abp.BlobStoring 项目自行实现
+
+ var fileSystem = platform.AddPermission(PlatformPermissions.FileSystem.Default, L("Permission:FileSystem"));
+ fileSystem.AddChild(PlatformPermissions.FileSystem.Create, L("Permission:CreateFolder"));
+ fileSystem.AddChild(PlatformPermissions.FileSystem.Delete, L("Permission:DeleteFolder"));
+ fileSystem.AddChild(PlatformPermissions.FileSystem.Rename, L("Permission:RenameFolder"));
+ fileSystem.AddChild(PlatformPermissions.FileSystem.Copy, L("Permission:CopyFolder"));
+ fileSystem.AddChild(PlatformPermissions.FileSystem.Move, L("Permission:MoveFolder"));
+
+ var fileManager = fileSystem.AddChild(PlatformPermissions.FileSystem.FileManager.Default, L("Permission:FileManager"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Create, L("Permission:AppendFile"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Update, L("Permission:UpdateFile"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Delete, L("Permission:DeleteFile"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Copy, L("Permission:CopyFile"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Move, L("Permission:MoveFile"));
+ fileManager.AddChild(PlatformPermissions.FileSystem.FileManager.Download, L("Permission:DownloadFile"));
+ }
+
+ private static LocalizableString L(string name)
+ {
+ return LocalizableString.Create(name);
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs
new file mode 100644
index 000000000..b4b0d3c5c
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Permissions/PlatformPermissions.cs
@@ -0,0 +1,70 @@
+using Volo.Abp.Reflection;
+
+namespace LINGYUN.Platform.Permissions
+{
+ public class PlatformPermissions
+ {
+ public const string GroupName = "Platform";
+
+ // 如果abp后期提供对象存储的目录管理接口,则启用此权限
+ ///
+ /// 文件系统
+ ///
+ public class FileSystem
+ {
+ public const string Default = GroupName + ".FileSystem";
+
+ public const string Create = Default + ".Create";
+
+ public const string Delete = Default + ".Delete";
+
+ public const string Rename = Default + ".Rename";
+
+ public const string Copy = Default + ".Copy";
+
+ public const string Move = Default + ".Move";
+
+ public class FileManager
+ {
+ public const string Default = FileSystem.Default + ".FileManager";
+
+ public const string Create = Default + ".Create";
+
+ public const string Copy = Default + ".Copy";
+
+ public const string Delete = Default + ".Delete";
+
+ public const string Update = Default + ".Update";
+
+ public const string Move = Default + ".Move";
+
+ public const string Download = Default + ".Download";
+ }
+ }
+
+ public class AppVersion
+ {
+ public const string Default = GroupName + ".AppVersion";
+
+ public const string Create = Default + ".Create";
+
+ public const string Delete = Default + ".Delete";
+
+ public class FileManager
+ {
+ public const string Default = AppVersion.Default + ".FileManager";
+
+ public const string Create = Default + ".Create";
+
+ public const string Delete = Default + ".Delete";
+
+ public const string Download = Default + ".Download";
+ }
+ }
+
+ public static string[] GetAll()
+ {
+ return ReflectionHelper.GetPublicConstantsRecursively(typeof(PlatformPermissions));
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs
deleted file mode 100644
index 124a55953..000000000
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/PlatformApplicationContractModule.cs
+++ /dev/null
@@ -1,10 +0,0 @@
-using Volo.Abp.Modularity;
-
-namespace LINGYUN.Platform
-{
- [DependsOn(typeof(PlatformDomainSharedModule))]
- public class PlatformApplicationContractModule : AbpModule
- {
-
- }
-}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs
index cace34964..2b06d44a5 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionDto.cs
@@ -11,6 +11,10 @@ namespace LINGYUN.Platform.Versions
///
public DateTime CreationTime { get; set; }
///
+ /// 标题
+ ///
+ public string Title { get; set; }
+ ///
/// 版本号
///
public string Version { get; set; }
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs
index f5c060199..3bb440a1b 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application.Contracts/LINGYUN/Platform/Versions/Dto/VersionFileDto.cs
@@ -4,6 +4,10 @@ namespace LINGYUN.Platform.Versions
{
public class VersionFileDto
{
+ ///
+ /// 文件路径
+ ///
+ public string Path { get; set; }
///
/// 文件名称
///
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs
similarity index 65%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs
index 71419ecb9..df2d61cb2 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationMappingProfile.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationMappingProfile.cs
@@ -3,9 +3,9 @@ using LINGYUN.Platform.Versions;
namespace LINGYUN.Platform
{
- public class PlatformApplicationMappingProfile : Profile
+ public class AppPlatformApplicationMappingProfile : Profile
{
- public PlatformApplicationMappingProfile()
+ public AppPlatformApplicationMappingProfile()
{
CreateMap();
CreateMap();
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs
similarity index 53%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs
index 91fa001f7..7d5222d8c 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/PlatformApplicationModule.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/AppPlatformApplicationModule.cs
@@ -4,16 +4,16 @@ using Volo.Abp.Modularity;
namespace LINGYUN.Platform
{
- [DependsOn(typeof(PlatformApplicationContractModule))]
- public class PlatformApplicationModule : AbpModule
+ [DependsOn(typeof(AppPlatformApplicationContractModule))]
+ public class AppPlatformApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
- context.Services.AddAutoMapperObjectMapper();
+ context.Services.AddAutoMapperObjectMapper();
Configure(options =>
{
- options.AddProfile(validate: true);
+ options.AddProfile(validate: true);
});
}
}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs
index 5c8834390..94736e324 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Application/LINGYUN/Platform/Versions/VersionAppService.cs
@@ -1,10 +1,13 @@
-using System.Collections.Generic;
+using LINGYUN.Platform.Permissions;
+using Microsoft.AspNetCore.Authorization;
+using System.Collections.Generic;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Application.Dtos;
namespace LINGYUN.Platform.Versions
{
+ [Authorize(PlatformPermissions.AppVersion.Default)]
public class VersionAppService : PlatformApplicationServiceBase, IVersionAppService
{
private readonly VersionManager _versionManager;
@@ -14,6 +17,7 @@ namespace LINGYUN.Platform.Versions
_versionManager = versionManager;
}
+ [Authorize(PlatformPermissions.AppVersion.FileManager.Create)]
public virtual async Task AppendFileAsync(VersionFileCreateDto versionFileCreate)
{
await _versionManager.AppendFileAsync(versionFileCreate.VersionId,
@@ -21,6 +25,7 @@ namespace LINGYUN.Platform.Versions
versionFileCreate.TotalByte, versionFileCreate.FilePath, versionFileCreate.FileType);
}
+ [Authorize(PlatformPermissions.AppVersion.Create)]
public virtual async Task CreateAsync(VersionCreateDto versionCreate)
{
if (await _versionManager.ExistsAsync(versionCreate.PlatformType,versionCreate.Version))
@@ -39,6 +44,7 @@ namespace LINGYUN.Platform.Versions
return ObjectMapper.Map(version);
}
+ [Authorize(PlatformPermissions.AppVersion.Delete)]
public virtual async Task DeleteAsync(VersionDeleteDto versionDelete)
{
var version = await _versionManager.GetByVersionAsync(versionDelete.PlatformType, versionDelete.Version);
@@ -48,6 +54,7 @@ namespace LINGYUN.Platform.Versions
}
}
+
public virtual async Task> GetAsync(VersionGetByPagedDto versionGetByPaged)
{
var versionCount = await _versionManager.GetCountAsync(versionGetByPaged.PlatformType, versionGetByPaged.Filter);
@@ -59,6 +66,7 @@ namespace LINGYUN.Platform.Versions
ObjectMapper.Map, List>(versions));
}
+
public virtual async Task GetAsync(VersionGetByIdDto versionGetById)
{
var version = await _versionManager.GetByIdAsync(versionGetById.Id);
@@ -73,16 +81,18 @@ namespace LINGYUN.Platform.Versions
return ObjectMapper.Map(version);
}
+ [Authorize(PlatformPermissions.AppVersion.FileManager.Delete)]
public virtual async Task RemoveAllFileAsync(VersionGetByIdDto versionGetById)
{
await _versionManager.RemoveAllFileAsync(versionGetById.Id);
}
+ [Authorize(PlatformPermissions.AppVersion.FileManager.Delete)]
public virtual async Task RemoveFileAsync(VersionFileDeleteDto versionFileDelete)
{
await _versionManager.RemoveFileAsync(versionFileDelete.VersionId, versionFileDelete.FileName);
}
-
+
public virtual Task DownloadFileAsync(VersionFileGetDto versionFileGet)
{
// TODO: 是否需要定义此接口用于 abp-definition-api ?
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs
similarity index 79%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs
index 5a755b048..acc7df9f6 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformDomainSharedModule.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/AppPlatformDomainSharedModule.cs
@@ -8,13 +8,13 @@ using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Platform
{
[DependsOn(typeof(AbpLocalizationModule))]
- public class PlatformDomainSharedModule : AbpModule
+ public class AppPlatformDomainSharedModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure(options =>
{
- options.FileSets.AddEmbedded();
+ options.FileSets.AddEmbedded();
});
Configure(options =>
@@ -27,7 +27,7 @@ namespace LINGYUN.Platform
Configure(options =>
{
- options.MapCodeNamespace("LINGYUN.Platform", typeof(AbpValidationResource));
+ options.MapCodeNamespace("Platform.VersionFile", typeof(PlatformResource));
});
}
}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobConsts.cs
new file mode 100644
index 000000000..fc68f431f
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobConsts.cs
@@ -0,0 +1,16 @@
+namespace LINGYUN.Platform.BlobStoring
+{
+ public static class BlobConsts
+ {
+ public static int MaxNameLength
+ {
+ get;
+ set;
+ } = 255;
+ public static int MaxSha256Length
+ {
+ get;
+ set;
+ } = 65;
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobContainerConsts.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobContainerConsts.cs
new file mode 100644
index 000000000..304dd4dbc
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/BlobStoring/BlobContainerConsts.cs
@@ -0,0 +1,17 @@
+namespace LINGYUN.Platform.BlobStoring
+{
+ public static class BlobContainerConsts
+ {
+ public static int MaxNameLength
+ {
+ get;
+ set;
+ } = 255;
+
+ public static int MaxPathLength
+ {
+ get;
+ set;
+ } = 255;
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json
index aad2c838f..0041349ef 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/en.json
@@ -1,6 +1,7 @@
{
"culture": "en",
"texts": {
+ "Platform.VersionFile:404": "File not found, name: {FileName}, version:{FileVersion}!",
"UploadFileSizeBeyondLimit": "Upload file size cannot exceed {0} MB!",
"NotAllowedFileExtensionName": "Not allowed file extension: {0}!",
"DisplayName:VersionFileLimitLength": "File limit size",
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json
index dcb79b404..049b1aa35 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/Localization/Resources/zh-Hans.json
@@ -1,6 +1,7 @@
{
"culture": "zh-Hans",
"texts": {
+ "Platform.VersionFile:404": "文件: {FileName}, 版本号:{FileVersion} 不存在!",
"UploadFileSizeBeyondLimit": "上传文件大小不能超过 {0} MB!",
"NotAllowedFileExtensionName": "不被允许的文件扩展名: {0}!",
"DisplayName:VersionFileLimitLength": "文件限制大小",
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs
new file mode 100644
index 000000000..ff48ac5d9
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain.Shared/LINGYUN/Platform/PlatformErrorCodes.cs
@@ -0,0 +1,7 @@
+namespace LINGYUN.Platform
+{
+ public static class PlatformErrorCodes
+ {
+ public const string VersionFileNotFound = "Platform.VersionFile:404";
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs
similarity index 83%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs
index b6cc902a0..9a23bb6e0 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDbProperties.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDbProperties.cs
@@ -1,6 +1,6 @@
namespace LINGYUN.Platform
{
- public static class PlatformDbProperties
+ public static class AppPlatformDbProperties
{
public static string DbTablePrefix { get; set; } = "AppPlatform";
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs
similarity index 80%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs
index 9c6016ad2..bcfd08378 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainMappingProfile.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainMappingProfile.cs
@@ -4,9 +4,9 @@ using LINGYUN.Platform.Versions;
namespace LINGYUN.Platform
{
- public class PlatformDomainMappingProfile : Profile
+ public class AppPlatformDomainMappingProfile : Profile
{
- public PlatformDomainMappingProfile()
+ public AppPlatformDomainMappingProfile()
{
CreateMap();
CreateMap();
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs
similarity index 82%
rename from aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs
index af6866dda..c68379d0a 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/PlatformDomainModule.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/AppPlatformDomainModule.cs
@@ -12,18 +12,18 @@ using Volo.Abp.ObjectExtending.Modularity;
namespace LINGYUN.Platform
{
[DependsOn(
- typeof(PlatformDomainSharedModule),
+ typeof(AppPlatformDomainSharedModule),
typeof(AbpBlobStoringModule),
typeof(AbpEventBusModule))]
- public class PlatformDomainModule : AbpModule
+ public class AppPlatformDomainModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
- context.Services.AddAutoMapperObjectMapper();
+ context.Services.AddAutoMapperObjectMapper();
Configure(options =>
{
- options.AddProfile(validate: true);
+ options.AddProfile(validate: true);
});
Configure(options =>
@@ -36,11 +36,11 @@ namespace LINGYUN.Platform
Configure(options =>
{
- options.EtoMappings.Add(typeof(PlatformDomainModule));
- options.EtoMappings.Add(typeof(PlatformDomainModule));
- options.EtoMappings.Add(typeof(PlatformDomainModule));
+ options.EtoMappings.Add(typeof(AppPlatformDomainModule));
+ options.EtoMappings.Add(typeof(AppPlatformDomainModule));
+ options.EtoMappings.Add(typeof(AppPlatformDomainModule));
- options.EtoMappings.Add(typeof(PlatformDomainModule));
+ options.EtoMappings.Add(typeof(AppPlatformDomainModule));
});
}
public override void PostConfigureServices(ServiceConfigurationContext context)
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/Blob.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/Blob.cs
new file mode 100644
index 000000000..0f14135a5
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/Blob.cs
@@ -0,0 +1,35 @@
+using JetBrains.Annotations;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp;
+using Volo.Abp.Domain.Entities;
+using Volo.Abp.Domain.Entities.Auditing;
+using Volo.Abp.MultiTenancy;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ public class Blob : AuditedAggregateRoot, IMultiTenant
+ {
+ public virtual Guid ContainerId { get; protected set; }
+ public virtual Guid? TenantId { get; protected set; }
+ public virtual string Name { get; protected set; }
+ public virtual string Sha256 { get; protected set; }
+ public virtual long Size { get; protected set; }
+ protected Blob() { }
+ public Blob(Guid id, Guid containerId, [NotNull] string name, [NotNull] string sha256, long size, Guid? tenantId)
+ {
+ Id = id;
+ ContainerId = containerId;
+ ChangeFile(name, sha256, size);
+ TenantId = tenantId;
+ }
+
+ public void ChangeFile(string name, string sha256, long size)
+ {
+ Name = Check.NotNullOrWhiteSpace(name, nameof(name), BlobConsts.MaxNameLength);
+ Sha256 = Check.NotNullOrWhiteSpace(sha256, nameof(sha256), BlobConsts.MaxSha256Length);
+ Size = size;
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobContainer.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobContainer.cs
new file mode 100644
index 000000000..cb2af53d7
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobContainer.cs
@@ -0,0 +1,23 @@
+using JetBrains.Annotations;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Volo.Abp;
+using Volo.Abp.Domain.Entities.Auditing;
+using Volo.Abp.MultiTenancy;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ public class BlobContainer : AuditedAggregateRoot, IMultiTenant
+ {
+ public virtual Guid? TenantId { get; protected set; }
+ public virtual string Name { get; protected set; }
+ public BlobContainer(Guid id, [NotNull] string name, Guid? tenantId = null)
+ : base(id)
+ {
+ Name = Check.NotNullOrWhiteSpace(name, nameof(name), BlobContainerConsts.MaxNameLength);
+ TenantId = tenantId;
+ }
+
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobStoringManager.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobStoringManager.cs
new file mode 100644
index 000000000..7059caab7
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/BlobStoringManager.cs
@@ -0,0 +1,71 @@
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Volo.Abp.BlobStoring;
+using Volo.Abp.Domain.Services;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ public class BlobStoringManager : DomainService
+ {
+ private IBlobRepository _blobRepository;
+ protected IBlobRepository BlobRepository => LazyGetRequiredService(ref _blobRepository);
+
+ private IBlobContainerRepository _containerRepository;
+ protected IBlobContainerRepository ContainerRepository => LazyGetRequiredService(ref _containerRepository);
+
+ protected IBlobContainerFactory BlobContainerFactory { get; }
+ protected IBlobContainerConfigurationProvider BlobContainerConfigurationProvider { get; }
+
+ public virtual async Task CreateContainerAsync(string name)
+ {
+ var containerConfiguration = BlobContainerConfigurationProvider.Get();
+ var containerName = NormalizeContainerName(containerConfiguration, name);
+ if (await ContainerRepository.ContainerExistsAsync(name))
+ {
+
+ }
+ // 框架暂时未实现创建Container ,这里采用保存一个空文件,然后删除此文件的方法来创建Container
+ var blobContainer = BlobContainerFactory.Create(containerName);
+ try
+ {
+ var emptyBlobData = System.Text.Encoding.UTF8.GetBytes("");
+ await blobContainer.SaveAsync("empty.txt", emptyBlobData, true);
+ var container = new BlobContainer(GuidGenerator.Create(), containerName, CurrentTenant.Id)
+ {
+ CreationTime = Clock.Now
+ };
+ await ContainerRepository.InsertAsync(container);
+ }
+ finally
+ {
+ await blobContainer.DeleteAsync("empty.txt");
+ }
+ }
+
+ protected virtual string NormalizeContainerName(BlobContainerConfiguration configuration, string containerName)
+ {
+ if (!configuration.NamingNormalizers.Any())
+ {
+ return containerName;
+ }
+
+ using (var scope = ServiceProvider.CreateScope())
+ {
+ foreach (var normalizerType in configuration.NamingNormalizers)
+ {
+ var normalizer = scope.ServiceProvider
+ .GetRequiredService(normalizerType)
+ .As();
+
+ containerName = normalizer.NormalizeContainerName(containerName);
+ }
+
+ return containerName;
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobContainerRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobContainerRepository.cs
new file mode 100644
index 000000000..df81afe3e
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobContainerRepository.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Threading;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ public interface IBlobContainerRepository : IBasicRepository
+ {
+ Task ContainerExistsAsync(string name, CancellationToken cancellationToken = default);
+
+ Task GetByNameAsync(string name, CancellationToken cancellationToken = default);
+
+ Task GetCountAsync(string filter = "", CancellationToken cancellationToken = default);
+
+ Task> GetPagedListAsync(string filter = "", string sorting = nameof(BlobContainer.Name),
+ int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default);
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobRepository.cs
new file mode 100644
index 000000000..01a562351
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/IBlobRepository.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Volo.Abp.Domain.Repositories;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ public interface IBlobRepository : IBasicRepository
+ {
+ Task BlobExistsAsync(string sha256, CancellationToken cancellationToken = default);
+
+ Task GetBySha256Async(string sha256, CancellationToken cancellationToken = default);
+
+ Task CopyToAsync(Blob blob, Guid copyToContainerId, CancellationToken cancellationToken = default);
+
+ Task MoveToAsync(Blob blob, Guid moveToContainerId, CancellationToken cancellationToken = default);
+
+ Task GetCountAsync(Guid containerId, string filter = "", CancellationToken cancellationToken = default);
+
+ Task> GetPagedListAsync(Guid containerId, string filter = "", string sorting = nameof(Blob.Name),
+ int skipCount = 1, int maxResultCount = 10, CancellationToken cancellationToken = default);
+
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/OSSContainer.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/OSSContainer.cs
new file mode 100644
index 000000000..8eb262739
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/BlobStoring/OSSContainer.cs
@@ -0,0 +1,9 @@
+using Volo.Abp.BlobStoring;
+
+namespace LINGYUN.Platform.BlobStoring
+{
+ [BlobContainerName("abp-application-oss")]
+ public class OSSContainer
+ {
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs
index 244a499d1..2e39b6ab8 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Routes/Route.cs
@@ -8,6 +8,9 @@ using Volo.Abp.MultiTenancy;
namespace LINGYUN.Platform.Routes
{
+ // TODO: 因为abp的菜单设计模式是按照权限分配的,是否可以去掉路由的后台配置?
+ // 按钮、菜单权限可以在子权限中定义
+ // 数据权限需要DbContext拦截器或者创建一个数据过滤仓储的抽象类,需要过滤数据权限的继承自此仓储
public class Route : FullAuditedAggregateRoot, IMultiTenant
{
///
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs
index 2c7477578..82827fdc6 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/AppVersion.cs
@@ -103,7 +103,6 @@ namespace LINGYUN.Platform.Versions
.FirstOrDefault();
}
-
public bool FileExists(string name)
{
// TODO: Windows file system ?
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs
index 4b4d8d857..a118b7110 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionFile.cs
@@ -1,6 +1,4 @@
using System;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
using Volo.Abp.Domain.Entities.Auditing;
using Volo.Abp.IO;
using Volo.Abp.MultiTenancy;
@@ -94,7 +92,7 @@ namespace LINGYUN.Platform.Versions
//路径存储模式 如果传递了绝对路径,需要计算短路径
if (!filePath.IsNullOrWhiteSpace())
{
- return $"{appVersion}/{filePath.GetHash()}/{fileNameWithNotExten}/{fileVersion}/{fileName}";
+ return $"{appVersion}/{filePath.Md5()}/{fileNameWithNotExten}/{fileVersion}/{fileName}";
}
// 最终文件名为 应用版本号/文件名(不带扩展名)/文件版本/文件名
// 例: 1.0.0.0/test-upload-text-file/1.0.0.0/test-upload-text-file.text
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs
index a20390062..4289b01f3 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/LINGYUN/Platform/Versions/VersionManager.cs
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.IO;
using System.Security.Cryptography;
using System.Threading.Tasks;
+using Volo.Abp;
using Volo.Abp.BlobStoring;
using Volo.Abp.DependencyInjection;
using Volo.Abp.Domain.Services;
@@ -79,14 +80,22 @@ namespace LINGYUN.Platform.Versions
{
var appVersion = await GetByVersionAsync(platformType, version);
var versionFile = appVersion.FindFile(filePath, fileName, fileVersion);
+ if (versionFile == null)
+ {
+ throw new BusinessException(PlatformErrorCodes.VersionFileNotFound)
+ .WithData("FileName", fileName)
+ .WithData("FileVersion", fileVersion);
+ }
versionFile.Download();
return await VersionBlobContainer.GetAsync(
VersionFile.NormalizeBlobName(version, versionFile.Name, versionFile.Version, versionFile.Path));
}
+
public virtual async Task GetFileAsync(VersionFile versionFile)
{
- return await DownloadFileAsync(versionFile.AppVersion.PlatformType, versionFile.AppVersion.Version, versionFile.Path,
- versionFile.Name, versionFile.Version);
+ versionFile.Download();
+ return await VersionBlobContainer.GetAsync(
+ VersionFile.NormalizeBlobName(versionFile.AppVersion.Version, versionFile.Name, versionFile.Version, versionFile.Path));
}
public virtual async Task SaveFileAsync(string version, string filePath, string fileName, string fileVersion, byte[] data)
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/BytesExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/BytesExtensions.cs
new file mode 100644
index 000000000..af35b96d4
--- /dev/null
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/BytesExtensions.cs
@@ -0,0 +1,47 @@
+using System.Security.Cryptography;
+
+namespace System
+{
+ public static class BytesExtensions
+ {
+ public static string Md5(this byte[] data, bool lowercase = false)
+ {
+ using (var md5 = MD5.Create())
+ {
+ var hashBytes = md5.ComputeHash(data);
+ var md5Str = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? md5Str.ToLower() : md5Str;
+ }
+ }
+
+ public static string Sha1(this byte[] data, bool lowercase = false)
+ {
+ using (var sha = SHA1.Create())
+ {
+ var hashBytes = sha.ComputeHash(data);
+ var sha1 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha1.ToLower() : sha1;
+ }
+ }
+
+ public static string Sha256(this byte[] data, bool lowercase = false)
+ {
+ using (var sha = SHA256.Create())
+ {
+ var hashBytes = sha.ComputeHash(data);
+ var sha256 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha256.ToLower() : sha256;
+ }
+ }
+
+ public static string Sha512(this byte[] data, bool lowercase = false)
+ {
+ using (var sha = SHA512.Create())
+ {
+ var hashBytes = sha.ComputeHash(data);
+ var sha512 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha512.ToLower() : sha512;
+ }
+ }
+ }
+}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/StringExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/StringExtensions.cs
index f2118e789..488aa77b1 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/StringExtensions.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.Domain/System/StringExtensions.cs
@@ -5,12 +5,43 @@ namespace System
{
public static class StringExtensions
{
- public static string GetHash(this string str)
+ public static string Md5(this string str, bool lowercase = false)
{
- using (var sha = new SHA1Managed())
+ using (var md5 = MD5.Create())
+ {
+ var hashBytes = md5.ComputeHash(Encoding.UTF8.GetBytes(str));
+ var md5Str = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? md5Str.ToLower() : md5Str;
+ }
+ }
+
+ public static string Sha1(this string str, bool lowercase = false)
+ {
+ using (var sha = SHA1.Create())
+ {
+ var hashBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(str));
+ var sha1 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha1.ToLower() : sha1;
+ }
+ }
+
+ public static string Sha256(this string str, bool lowercase = false)
+ {
+ using (var sha = SHA256.Create())
+ {
+ var hashBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(str));
+ var sha256 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha256.ToLower() : sha256;
+ }
+ }
+
+ public static string Sha512(this string str, bool lowercase = false)
+ {
+ using (var sha = SHA512.Create())
{
var hashBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(str));
- return BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ var sha512 = BitConverter.ToString(hashBytes).Replace("-", string.Empty);
+ return lowercase ? sha512.ToLower() : sha512;
}
}
}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs
similarity index 93%
rename from aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs
index 9d01958d9..ee80123ca 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContextModelBuilderExtensions.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformDbContextModelBuilderExtensions.cs
@@ -7,17 +7,17 @@ using Volo.Abp.EntityFrameworkCore.Modeling;
namespace LINGYUN.Platform.EntityFrameworkCore
{
- public static class PlatformDbContextModelBuilderExtensions
+ public static class AppPlatformDbContextModelBuilderExtensions
{
public static void ConfigurePlatform(
this ModelBuilder builder,
- Action optionsAction = null)
+ Action optionsAction = null)
{
Check.NotNull(builder, nameof(builder));
- var options = new PlatformModelBuilderConfigurationOptions(
- PlatformDbProperties.DbTablePrefix,
- PlatformDbProperties.DbSchema
+ var options = new AppPlatformModelBuilderConfigurationOptions(
+ AppPlatformDbProperties.DbTablePrefix,
+ AppPlatformDbProperties.DbSchema
);
optionsAction?.Invoke(options);
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs
similarity index 90%
rename from aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs
index 3461419c7..56965a925 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformEntityFrameworkCoreModule.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformEntityFrameworkCoreModule.cs
@@ -8,9 +8,9 @@ using Volo.Abp.Modularity;
namespace LINGYUN.Platform.EntityFrameworkCore
{
[DependsOn(
- typeof(PlatformDomainModule),
+ typeof(AppPlatformDomainModule),
typeof(AbpEntityFrameworkCoreModule))]
- public class PlatformEntityFrameworkCoreModule : AbpModule
+ public class AppPlatformEntityFrameworkCoreModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs
similarity index 67%
rename from aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs
index 260ea5b4f..b7822c910 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformModelBuilderConfigurationOptions.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/AppPlatformModelBuilderConfigurationOptions.cs
@@ -3,9 +3,9 @@ using Volo.Abp.EntityFrameworkCore.Modeling;
namespace LINGYUN.Platform.EntityFrameworkCore
{
- public class PlatformModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions
+ public class AppPlatformModelBuilderConfigurationOptions : AbpModelBuilderConfigurationOptions
{
- public PlatformModelBuilderConfigurationOptions(
+ public AppPlatformModelBuilderConfigurationOptions(
[NotNull] string tablePrefix = "",
[CanBeNull] string schema = null)
: base(
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs
index 5876d6a5d..b76b7397e 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/IPlatformDbContext.cs
@@ -6,7 +6,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore
{
- [ConnectionStringName(PlatformDbProperties.ConnectionStringName)]
+ [ConnectionStringName(AppPlatformDbProperties.ConnectionStringName)]
public interface IPlatformDbContext : IEfCoreDbContext
{
DbSet Routes { get; set; }
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs
index 587c5ec29..e220bc6bd 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/EntityFrameworkCore/PlatformDbContext.cs
@@ -6,7 +6,7 @@ using Volo.Abp.EntityFrameworkCore;
namespace LINGYUN.Platform.EntityFrameworkCore
{
- [ConnectionStringName(PlatformDbProperties.ConnectionStringName)]
+ [ConnectionStringName(AppPlatformDbProperties.ConnectionStringName)]
public class PlatformDbContext : AbpDbContext, IPlatformDbContext
{
public DbSet Routes { get; set; }
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs
index d12b5ec0a..cb02161f9 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.EntityFrameworkCore/LINGYUN/Platform/Versions/EfCoreVersionRepository.cs
@@ -34,7 +34,8 @@ namespace LINGYUN.Platform.Versions
.IncludeIf(includeDetails, x => x.Files)
.Where(x => (platformType | x.PlatformType) == x.PlatformType)
.WhereIf(!filter.IsNullOrWhiteSpace(), x => x.Version.Contains(filter) || x.Title.Contains(filter))
- .OrderBy(soring ?? "") // TODO: 排序待优化
+ .OrderByDescending(x => x.CreationTime)
+ .ThenBy(soring ?? nameof(AppVersion.Version)) // TODO: 排序待优化
.Page(skipCount, maxResultCount)
.ToListAsync(GetCancellationToken(cancellationToken));
}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs
similarity index 84%
rename from aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs
rename to aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs
index b7aa8ce52..d82c5a069 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/PlatformHttpApiModule.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/AppPlatformHttpApiModule.cs
@@ -6,15 +6,15 @@ using Volo.Abp.Modularity;
namespace LINGYUN.Platform.HttpApi
{
[DependsOn(
- typeof(PlatformApplicationContractModule),
+ typeof(AppPlatformApplicationContractModule),
typeof(AbpAspNetCoreMvcModule))]
- public class PlatformHttpApiModule : AbpModule
+ public class AppPlatformHttpApiModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
PreConfigure(mvcBuilder =>
{
- mvcBuilder.AddApplicationPartIfNotExists(typeof(PlatformApplicationContractModule).Assembly);
+ mvcBuilder.AddApplicationPartIfNotExists(typeof(AppPlatformApplicationContractModule).Assembly);
});
}
diff --git a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs
index c02899904..b014e799e 100644
--- a/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs
+++ b/aspnet-core/modules/platform/LINGYUN.Platform.HttpApi/LINGYUN/Platform/Versions/VersionController.cs
@@ -1,4 +1,6 @@
-using LINGYUN.Platform.Settings;
+using LINGYUN.Platform.Permissions;
+using LINGYUN.Platform.Settings;
+using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.StaticFiles;
@@ -31,6 +33,7 @@ namespace LINGYUN.Platform.Versions
[HttpPost]
[Route("file/append")]
+ [RequestSizeLimit(200_000_000)]
public virtual async Task AppendFileAsync([FromQuery] VersionFileCreateDto versionFileCreate)
{
// 检查文件大小
@@ -168,6 +171,7 @@ namespace LINGYUN.Platform.Versions
[HttpGet]
[Route("file/download")]
+ [Authorize(PlatformPermissions.AppVersion.FileManager.Download)]
public virtual async Task DownloadFileAsync(VersionFileGetDto versionFileGet)
{
// 分块模式下载文件
diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
index 6bf20a1ef..d6f0a2214 100644
--- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
+++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/BackendAdminHostModule.cs
@@ -10,6 +10,7 @@ using LINGYUN.Abp.SettingManagement;
using LINGYUN.Abp.TenantManagement;
using LINGYUN.ApiGateway;
using LINGYUN.BackendAdmin.MultiTenancy;
+using LINGYUN.Platform;
using LINYUN.Abp.Sms.Aliyun;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.DataProtection;
@@ -55,6 +56,7 @@ namespace LINGYUN.BackendAdmin
typeof(AbpAspNetCoreMvcUiMultiTenancyModule),
typeof(AbpPermissionManagementDomainIdentityModule),
typeof(AbpPermissionManagementDomainIdentityServerModule),
+ typeof(AppPlatformApplicationContractModule),
typeof(ApiGatewayApplicationContractsModule),
typeof(AbpMessageServiceApplicationContractsModule),
typeof(AbpIdentityHttpApiModule),
@@ -81,9 +83,7 @@ namespace LINGYUN.BackendAdmin
typeof(AbpEmailingExceptionHandlingModule),
typeof(AbpCAPEventBusModule),
typeof(AbpAliyunSmsModule),
-#if DEBUG
typeof(AbpTencentLocationModule),
-#endif
typeof(AbpAutofacModule)
)]
public class BackendAdminHostModule : AbpModule
diff --git a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
index 43b286adb..7c5d91527 100644
--- a/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
+++ b/aspnet-core/services/admin/LINGYUN.BackendAdminApp.Host/LINGYUN.BackendAdminApp.Host.csproj
@@ -70,6 +70,7 @@
+
diff --git a/aspnet-core/services/cleanup-logs.bat b/aspnet-core/services/cleanup-logs.bat
index 4afd1f6ef..6a16f4e97 100644
--- a/aspnet-core/services/cleanup-logs.bat
+++ b/aspnet-core/services/cleanup-logs.bat
@@ -9,4 +9,5 @@ del .\apigateway\LINGYUN.ApiGateway.Host\Logs /Q
del .\apigateway\LINGYUN.ApiGateway.HttpApi.Host\Logs /Q
del .\account\AuthServer.Host\Logs /Q
del .\messages\LINGYUN.Abp.MessageService.HttpApi.Host\Logs /Q
+del .\admin\LINGYUN.BackendAdminApp.Host\Logs /Q
diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
similarity index 96%
rename from aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs
rename to aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
index 95d54da11..bccd24c78 100644
--- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/PlatformHttpApiHostModule.cs
+++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/AppPlatformHttpApiHostModule.cs
@@ -40,9 +40,9 @@ using Volo.Abp.VirtualFileSystem;
namespace LINGYUN.Platform
{
[DependsOn(
- typeof(PlatformApplicationModule),
- typeof(PlatformHttpApiModule),
- typeof(PlatformEntityFrameworkCoreModule),
+ typeof(AppPlatformApplicationModule),
+ typeof(AppPlatformHttpApiModule),
+ typeof(AppPlatformEntityFrameworkCoreModule),
typeof(AbpAspNetCoreMultiTenancyModule),
typeof(AbpTenantManagementEntityFrameworkCoreModule),
typeof(AbpSettingManagementEntityFrameworkCoreModule),
@@ -54,7 +54,7 @@ namespace LINGYUN.Platform
typeof(AbpBlobStoringFileSystemModule),
typeof(AbpAutofacModule)
)]
- public class PlatformHttpApiHostModule : AbpModule
+ public class AppPlatformHttpApiHostModule : AbpModule
{
public override void PreConfigureServices(ServiceConfigurationContext context)
{
@@ -134,7 +134,7 @@ namespace LINGYUN.Platform
Configure(options =>
{
- options.FileSets.AddEmbedded("LINGYUN.Platform");
+ options.FileSets.AddEmbedded("LINGYUN.Platform");
});
// 多租户
diff --git a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Startup.cs b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Startup.cs
index 4e90cd498..f92b5443a 100644
--- a/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Startup.cs
+++ b/aspnet-core/services/platform/LINGYUN.Platform.HttpApi.Host/Startup.cs
@@ -7,7 +7,7 @@ namespace LINGYUN.Platform
{
public void ConfigureServices(IServiceCollection services)
{
- services.AddApplication();
+ services.AddApplication();
}
public void Configure(IApplicationBuilder app)
diff --git a/aspnet-core/services/start-all-service.bat b/aspnet-core/services/start-all-service.bat
index 1527d49c4..0893c8e89 100644
--- a/aspnet-core/services/start-all-service.bat
+++ b/aspnet-core/services/start-all-service.bat
@@ -5,5 +5,6 @@ start .\start-identity-server.bat --run
start .\start-apigateway-admin.bat --run
start .\start-backend-admin.bat --run
start .\start-messages.bat --run
+start .\start-platform.bat --run
ping -n 10 127.1 >nul
start .\start-apigateway-host.bat --run
\ No newline at end of file
diff --git a/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN.Abp.EntityFrameworkCore.Tests.csproj b/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN.Abp.EntityFrameworkCore.Tests.csproj
new file mode 100644
index 000000000..e7fc0d823
--- /dev/null
+++ b/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN.Abp.EntityFrameworkCore.Tests.csproj
@@ -0,0 +1,18 @@
+
+
+
+ netcoreapp3.1
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs b/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs
new file mode 100644
index 000000000..099e9a89d
--- /dev/null
+++ b/aspnet-core/tests/LINGYUN.Abp.EntityFrameworkCore.Tests/LINGYUN/Abp/EntityFrameworkCore/AbpEntityFrameworkCoreTestModule.cs
@@ -0,0 +1,36 @@
+using LINGYUN.Abp.Tests;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.Extensions.DependencyInjection;
+using System;
+using Volo.Abp.EntityFrameworkCore;
+using Volo.Abp.Modularity;
+using Volo.Abp.Uow;
+
+namespace LINGYUN.Abp.EntityFrameworkCore.Tests
+{
+ [DependsOn(
+ typeof(AbpTestsBaseModule)
+ )]
+ public class AbpEntityFrameworkCoreTestModule : AbpModule
+ {
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ context.Services.AddEntityFrameworkInMemoryDatabase();
+
+ var databaseName = Guid.NewGuid().ToString();
+
+ Configure(options =>
+ {
+ options.Configure(abpDbContextConfigurationContext =>
+ {
+ abpDbContextConfigurationContext.DbContextOptions.UseInMemoryDatabase(databaseName);
+ });
+ });
+
+ Configure(options =>
+ {
+ options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled; //EF in-memory database does not support transactions
+ });
+ }
+ }
+}