diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs
new file mode 100644
index 00000000..2c9ad759
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs
@@ -0,0 +1,38 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 创建文件
+///
+public class CreateFileObjectInput
+{
+ ///
+ /// 文件Provider
+ ///
+ [Required(ErrorMessage = "文件Provider不能为空")]
+ public string ProviderKey { get; set; }
+ ///
+ /// 文件扩展名
+ ///
+ [Required(ErrorMessage = "文件扩展名不能为空")]
+ public string FileExtension { get; set; }
+ ///
+ /// 二进制数据
+ ///
+ [Required(ErrorMessage = "二进制数据不能为空")]
+ public long Bytes { get; set; }
+ ///
+ /// 文件大小
+ ///
+ [Required(ErrorMessage = "文件大小不能为空")]
+ public long FileSize { get; set; }
+ ///
+ /// 文件名称
+ ///
+ [Required(ErrorMessage = "文件名称不能为空")]
+ public string ContentType { get; set; }
+ ///
+ /// 文件名称
+ ///
+ [Required(ErrorMessage = "文件名称不能为空")]
+ public string FileName { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DeleteFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DeleteFileObjectInput.cs
new file mode 100644
index 00000000..2ebb4209
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DeleteFileObjectInput.cs
@@ -0,0 +1,12 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 删除文件
+///
+public class DeleteFileObjectInput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DownloadFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DownloadFileObjectInput.cs
new file mode 100644
index 00000000..47cc31f0
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DownloadFileObjectInput.cs
@@ -0,0 +1,9 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class DownloadFileObjectInput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/CreateFileInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/CreateFileInput.cs
deleted file mode 100644
index 8b6f0f91..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/CreateFileInput.cs
+++ /dev/null
@@ -1,8 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files.Dto;
-
-public class CreateFileInput
-{
- [Required(ErrorMessage = "文件名不能为空")] public string FileName { get; set; }
-
- [Required(ErrorMessage = "文件地址不能为空")] public string FilePath { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/FileTokenOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/FileTokenOutput.cs
deleted file mode 100644
index b480cc29..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/FileTokenOutput.cs
+++ /dev/null
@@ -1,19 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files.Dto;
-
-public class FileTokenOutput
-{
- public string AccessKeyId { get; set; }
-
- public string AccessKeySecret { get; set; }
-
- public string Token { get; set; }
-
- ///
- /// 过期时间
- ///
- public string Expiration { get; set; }
-
- public string Bucket { get; set; }
-
- public string Region { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingFileOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingFileOutput.cs
deleted file mode 100644
index 352f2685..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingFileOutput.cs
+++ /dev/null
@@ -1,14 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files.Dto;
-
-public class PagingFileOutput
-{
- public Guid Id { get; set; }
-
- public Guid? TenantId { get; set; }
-
- public string FileName { get; set; }
-
- public string FilePath { get; set; }
-
- public DateTime CreationTime { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingInput.cs
deleted file mode 100644
index aa4c70b7..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingInput.cs
+++ /dev/null
@@ -1,6 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files.Dto;
-
-public class PagingFileInput : PagingBase
-{
- public string Filter { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs
new file mode 100644
index 00000000..2b011195
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs
@@ -0,0 +1,9 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class GetFileObjectInput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs
new file mode 100644
index 00000000..e2da2dff
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs
@@ -0,0 +1,44 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class GetFileObjectOutput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 文件Provider
+ ///
+ public string ProviderKey { get; set; }
+
+ ///
+ /// 文件扩展名
+ ///
+ public string FileExtension { get; set; }
+
+ ///
+ /// 二进制数据
+ ///
+ public byte[] Bytes { get; set; }
+
+ ///
+ /// 文件大小
+ ///
+ public long FileSize { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string ContentType { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreationTime { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
index 4b41d92d..8ebfe68c 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
@@ -1,15 +1,34 @@
-using System.Collections.Generic;
-using System.Threading.Tasks;
-using Lion.AbpPro.FileManagement.Files.Dto;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace Lion.AbpPro.FileManagement.Files;
+///
+/// 文件
+///
public interface IFileAppService : IApplicationService
{
- Task GetFileTokenAsync();
- Task CreateAsync(CreateFileInput input);
+ ///
+ /// 分页查询文件
+ ///
+ Task> PageAsync(PageFileObjectInput input);
- Task> PagingAsync(PagingFileInput input);
+ ///
+ /// 上传文件
+ ///
+ Task> UploadAsync(List files);
+
+ ///
+ /// 删除文件
+ ///
+ Task DeleteAsync(DeleteFileObjectInput input);
+
+ Task GetAsync(GetFileObjectInput input);
+
+ ///
+ /// 下载文件
+ ///
+ Task DownloadAsync(DownloadFileObjectInput input);
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectInput.cs
new file mode 100644
index 00000000..c737d280
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectInput.cs
@@ -0,0 +1,22 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 分页查询文件
+///
+public class PageFileObjectInput : PagingBase
+{
+ ///
+ /// 开始创建时间
+ ///
+ public DateTime? StartCreationTime { get; set; }
+
+ ///
+ /// 结束创建时间
+ ///
+ public DateTime? EndCreationTime { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
new file mode 100644
index 00000000..cab050f8
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
@@ -0,0 +1,47 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 分页查询文件
+///
+public class PageFileObjectOutput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 文件Provider
+ ///
+ public string ProviderKey { get; set; }
+
+ ///
+ /// 文件扩展名
+ ///
+ public string FileExtension { get; set; }
+
+ // ///
+ // /// 二进制数据
+ // ///
+ // public byte[] Bytes { get; set; }
+
+ ///
+ /// 文件大小
+ ///
+ public long FileSize { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string ContentType { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreationTime { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs
new file mode 100644
index 00000000..38eddc81
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs
@@ -0,0 +1,43 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 更新文件
+///
+public class UpdateFileInput
+{
+ ///
+ /// 文件Id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 文件Provider
+ ///
+ [Required(ErrorMessage = "文件Provider不能为空")]
+ public string ProviderKey { get; set; }
+ ///
+ /// 文件扩展名
+ ///
+ [Required(ErrorMessage = "文件扩展名不能为空")]
+ public string FileExtension { get; set; }
+ ///
+ /// 二进制数据
+ ///
+ [Required(ErrorMessage = "二进制数据不能为空")]
+ public long Bytes { get; set; }
+ ///
+ /// 文件大小
+ ///
+ [Required(ErrorMessage = "文件大小不能为空")]
+ public long FileSize { get; set; }
+ ///
+ /// 文件名称
+ ///
+ [Required(ErrorMessage = "文件名称不能为空")]
+ public string ContentType { get; set; }
+ ///
+ /// 文件名称
+ ///
+ [Required(ErrorMessage = "文件名称不能为空")]
+ public string FileName { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs
new file mode 100644
index 00000000..478cd849
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs
@@ -0,0 +1,13 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class UploadOutput
+{
+ public Guid Id { get; set; }
+
+ public string Name { get; set; }
+
+ public bool Success { get; set; }
+
+
+ public string Path { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj
index adce61be..766bc2ac 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj
@@ -7,8 +7,10 @@
+
+
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
index 707206fd..71f46e69 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
@@ -4,13 +4,10 @@ public class FileManagementPermissionDefinitionProvider : PermissionDefinitionPr
{
public override void Define(IPermissionDefinitionContext context)
{
-
var abpIdentityGroup = context.GetGroup("AbpIdentity");
- var dataDictionaryManagement = abpIdentityGroup.AddPermission(FileManagementPermissions.FileManagement.Default,
+ var fileManagement = abpIdentityGroup.AddPermission(FileManagementPermissions.FileManagement.Default,
L("Permission:FileManagement"));
- dataDictionaryManagement.AddChild(FileManagementPermissions.FileManagement.Upload, L("Permission:Upload"));
- //dataDictionaryManagement.AddChild(FileManagementPermissions.FileManagement.Down, L("Permission:Down"));
}
private static LocalizableString L(string name)
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
index a3906418..0e110b91 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
@@ -1,9 +1,12 @@
+using Lion.AbpPro.FileManagement.Files;
+
namespace Lion.AbpPro.FileManagement;
public class FileManagementApplicationAutoMapperProfile : Profile
{
public FileManagementApplicationAutoMapperProfile()
{
- CreateMap();
+ CreateMap();
+ CreateMap();
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationModule.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationModule.cs
index 201df184..7a7d83b2 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationModule.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationModule.cs
@@ -4,38 +4,13 @@ namespace Lion.AbpPro.FileManagement;
typeof(FileManagementDomainModule),
typeof(FileManagementApplicationContractsModule),
typeof(AbpDddApplicationModule),
- typeof(AbpAutoMapperModule),
- typeof(AbpBlobStoringAliyunModule)
+ typeof(AbpAutoMapperModule)
)]
public class FileManagementApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper();
- ConfigureBlobStoringAliyun(context);
Configure(options => { options.AddMaps(true); });
}
-
- private void ConfigureBlobStoringAliyun(ServiceConfigurationContext context)
- {
- var configuration = context.Services.GetConfiguration();
-
- Configure(options =>
- {
- options.Containers.ConfigureDefault(container =>
- {
- container.UseAliyun(aliyun =>
- {
- aliyun.AccessKeyId =
- configuration.GetValue("AliYun:OSS:AccessKeyId");
- aliyun.AccessKeySecret =
- configuration.GetValue("AliYun:OSS:AccessKeySecret");
- aliyun.Endpoint = configuration.GetValue("AliYun:OSS:Endpoint");
- aliyun.RegionId = configuration.GetValue("AliYun:OSS:RegionId");
- aliyun.ContainerName =
- configuration.GetValue("AliYun:OSS:ContainerName");
- });
- });
- });
- }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
index d984ffb2..14b2da5b 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
@@ -1,59 +1,104 @@
-namespace Lion.AbpPro.FileManagement.Files;
+using Lion.AbpPro.FileManagement.Provider;
+using Microsoft.AspNetCore.Http;
+using Microsoft.AspNetCore.Mvc;
+using Microsoft.Extensions.Logging;
-[Authorize(FileManagementPermissions.FileManagement.Default)]
-public class FileAppService : FileManagementAppService, IFileAppService
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 文件
+///
+[Authorize]
+public class FileAppService : ApplicationService, IFileAppService
{
- private readonly IFileManager _fileManager;
- private readonly IConfiguration _configuration;
+ private readonly FileObjectManager _fileObjectManager;
+ private readonly IFileProvider _fileProvider;
- public FileAppService(IFileManager fileManager, IConfiguration configuration)
+ public FileAppService(FileObjectManager fileObjectManager, IFileProvider fileProvider)
{
- _fileManager = fileManager;
- _configuration = configuration;
+ _fileObjectManager = fileObjectManager;
+ _fileProvider = fileProvider;
}
-
- public virtual async Task GetFileTokenAsync()
+
+ ///
+ /// 分页查询文件
+ ///
+ public async Task> PageAsync(PageFileObjectInput input)
{
- // 如何设置 sts https://help.aliyun.com/document_detail/100624.html
- var regionId = _configuration.GetValue("AliYun:OSS:RegionId");
- var accessKeyId = _configuration.GetValue("AliYun:OSS:AccessKeyId");
- var accessKeySecret = _configuration.GetValue("AliYun:OSS:AccessKeySecret");
- var profile = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
- var client = new DefaultAcsClient(profile);
- var request = new AssumeRoleRequest()
- {
- RoleArn = _configuration.GetValue("AliYun:OSS:RoleArn"),
- RoleSessionName = "Lion.AbpPro"
- };
- var response = client.GetAcsResponse(request);
+ var result = new PagedResultDto();
+ var totalCount = await _fileObjectManager.GetCountAsync(input.FileName, input.StartCreationTime, input.EndCreationTime);
+ result.TotalCount = totalCount;
+ if (totalCount <= 0) return result;
+ var list = await _fileObjectManager.GetListAsync(input.FileName, input.StartCreationTime, input.EndCreationTime, input.PageSize, input.SkipCount);
+ result.Items = ObjectMapper.Map, List>(list);
+ return result;
+ }
- var result = new FileTokenOutput()
+ public async Task> UploadAsync(List files)
+ {
+ var result = new List();
+ foreach (var formFile in files)
{
- AccessKeyId = response.Credentials.AccessKeyId,
- AccessKeySecret = response.Credentials.AccessKeySecret,
- Token = response.Credentials.SecurityToken,
- Expiration = response.Credentials.Expiration,
- Region = _configuration.GetValue("AliYun:OSS:RegionId"),
- Bucket = _configuration.GetValue("AliYun:OSS:ContainerName"),
- };
- return await Task.FromResult(result);
+ try
+ {
+ var item = new UploadOutput();
+ // 获取文件的二进制数据
+ using var memoryStream = new MemoryStream();
+ await formFile.CopyToAsync(memoryStream);
+ var fileBytes = memoryStream.ToArray();
+
+ // 这里可以对 fileBytes 进行后续处理,例如保存到数据库或文件系统等
+ // 示例:将文件保存到数据库
+ var updateResult = await _fileProvider.UploadAsync(new UpdateDto()
+ {
+ FileName = formFile.FileName,
+ Bytes = fileBytes,
+ ContentType = formFile.ContentType,
+ FileSize = formFile.Length
+ });
+
+ result.Add(new UploadOutput()
+ {
+ Id = updateResult.Id,
+ Name = updateResult.FileName,
+ Path = updateResult.FilePath,
+ Success = true
+ });
+ }
+ catch (Exception e)
+ {
+ Logger.LogError(e, "上传文件失败");
+ result.Add(new UploadOutput()
+ {
+ Id = Guid.Empty,
+ Name = formFile.FileName,
+ Path = string.Empty,
+ Success = false
+ });
+ }
+ }
+
+ return result;
}
- [Authorize(FileManagementPermissions.FileManagement.Upload)]
- public virtual async Task CreateAsync(CreateFileInput input)
+
+ ///
+ /// 删除文件
+ ///
+ public Task DeleteAsync(DeleteFileObjectInput input)
{
- await _fileManager.CreateAsync(input.FileName, input.FilePath);
+ return _fileObjectManager.DeleteAsync(input.Id);
}
- public virtual async Task> PagingAsync(PagingFileInput input)
+ public async Task GetAsync(GetFileObjectInput input)
{
- var result = new PagedResultDto();
- var totalCount = await _fileManager.CountAsync(input.Filter);
- result.TotalCount = totalCount;
- if (totalCount <= 0) return result;
- var entities = await _fileManager.PagingAsync(input.Filter, input.PageSize,
- input.SkipCount);
- result.Items = ObjectMapper.Map, List>(entities);
- return result;
+ var file = await _fileObjectManager.GetAsync(input.Id);
+ return ObjectMapper.Map(file);
+ }
+
+ public async Task DownloadAsync(DownloadFileObjectInput input)
+ {
+ var file = await _fileObjectManager.GetAsync(input.Id);
+ return new Microsoft.AspNetCore.Mvc.FileContentResult(file.Bytes, file.ContentType);
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
index 0594867a..c7d27333 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
@@ -2,11 +2,7 @@
global using System.Collections.Generic;
global using System.Threading.Tasks;
-global using Aliyun.Acs.Core;
-global using Aliyun.Acs.Core.Auth.Sts;
-global using Aliyun.Acs.Core.Profile;
global using AutoMapper;
-global using Lion.AbpPro.FileManagement.Files.Dto;
global using Lion.AbpPro.FileManagement.Localization;
global using Lion.AbpPro.FileManagement.Permissions;
global using Microsoft.AspNetCore.Authorization;
@@ -16,6 +12,4 @@ global using Volo.Abp.Application;
global using Volo.Abp.Application.Dtos;
global using Volo.Abp.Application.Services;
global using Volo.Abp.AutoMapper;
-global using Volo.Abp.BlobStoring;
-global using Volo.Abp.BlobStoring.Aliyun;
global using Volo.Abp.Modularity;
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj
index 543524e3..b9a9a855 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj
@@ -7,9 +7,9 @@
+
-
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
new file mode 100644
index 00000000..b1731526
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
@@ -0,0 +1,51 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 文件
+///
+public class FileObjectDto
+{
+ ///
+ /// 主键Id
+ ///
+ public Guid Id { get; set; }
+
+ ///
+ /// 创建时间
+ ///
+ public DateTime CreationTime { get; set; }
+
+ ///
+ /// 文件Provider
+ ///
+ public string ProviderKey { get; set; }
+ ///
+ /// 文件扩展名
+ ///
+ public string FileExtension { get; set; }
+
+ ///
+ /// 二进制数据
+ ///
+ public byte[] Bytes { get; set; }
+ ///
+ /// 文件大小
+ ///
+ public long FileSize { get; set; }
+ ///
+ /// 文件名称
+ ///
+ public string ContentType { get; set; }
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; set; }
+
+
+ private const string CacheKeyFormat = "i:{0}";
+
+ public static string CalculateCacheKey(Guid id)
+ {
+ return string.Format(CacheKeyFormat, id);
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateDto.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateDto.cs
new file mode 100644
index 00000000..f25c378f
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateDto.cs
@@ -0,0 +1,26 @@
+namespace Lion.AbpPro.FileManagement.Provider;
+
+public class UpdateDto
+{
+ ///
+ /// 二进制数据
+ ///
+ public byte[] Bytes { get; set; }
+
+ ///
+ /// 文件大小
+ ///
+ public long FileSize { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string ContentType { get; set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; set; }
+
+ public Dictionary ExtraProperties { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateResult.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateResult.cs
new file mode 100644
index 00000000..48127f27
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateResult.cs
@@ -0,0 +1,17 @@
+namespace Lion.AbpPro.FileManagement.Provider;
+
+public class UpdateResult
+{
+ public Guid Id { get; set; }
+
+ public string FileName { get; set; }
+
+ public string FilePath { get; set; }
+
+ public UpdateResult()
+ {
+ ExtraProperties = new Dictionary();
+ }
+
+ public Dictionary ExtraProperties { get; set; }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDbProperties.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDbProperties.cs
index 42d55254..b060fa50 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDbProperties.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDbProperties.cs
@@ -3,7 +3,7 @@
public static class FileManagementDbProperties
{
public const string ConnectionStringName = "FileManagement";
- public static string DbTablePrefix { get; set; } = "";
+ public static string DbTablePrefix { get; set; } = "Abp";
public static string DbSchema { get; set; } = null;
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainAutoMapperProfile.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainAutoMapperProfile.cs
new file mode 100644
index 00000000..52348a97
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainAutoMapperProfile.cs
@@ -0,0 +1,13 @@
+using AutoMapper;
+using Lion.AbpPro.FileManagement.Files;
+
+namespace Lion.AbpPro.FileManagement
+{
+ public class FileManagementDomainAutoMapperProfile : Profile
+ {
+ public FileManagementDomainAutoMapperProfile()
+ {
+ CreateMap();
+ }
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
index 7371cff8..ee0cf99b 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
@@ -1,9 +1,16 @@
+using Volo.Abp.AutoMapper;
+
namespace Lion.AbpPro.FileManagement;
[DependsOn(
typeof(AbpDddDomainModule),
+ typeof(AbpAutoMapperModule),
typeof(FileManagementDomainSharedModule)
)]
public class FileManagementDomainModule : AbpModule
{
+ public override void ConfigureServices(ServiceConfigurationContext context)
+ {
+ Configure(options => { options.AddMaps(); });
+ }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/Aggregates/File.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/Aggregates/File.cs
deleted file mode 100644
index 38aa7fc5..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/Aggregates/File.cs
+++ /dev/null
@@ -1,22 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public class File: FullAuditedAggregateRoot, IMultiTenant
-{
- public Guid? TenantId { get; private set; }
-
- public string FileName { get; private set; }
-
- public string FilePath { get; private set; }
-
- private File()
- {
-
- }
-
- public File(Guid id, Guid? tenantId, string fileName, string filePath) : base(id)
- {
- TenantId = tenantId;
- FileName = fileName;
- FilePath = filePath;
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs
deleted file mode 100644
index db8a9c4c..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs
+++ /dev/null
@@ -1,33 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public class FileManager : DomainService, IFileManager
-{
- private readonly IFileRepository _fileRepository;
-
- public FileManager(IFileRepository fileRepository)
- {
- _fileRepository = fileRepository;
- }
-
- public virtual async Task CreateAsync(string fileName, string filePath)
- {
- Check.NotNullOrWhiteSpace(fileName, nameof(fileName));
- Check.NotNullOrWhiteSpace(filePath, nameof(filePath));
- var entity = new File(GuidGenerator.Create(), CurrentTenant.Id, fileName, filePath);
- await _fileRepository.InsertAsync(entity);
- }
-
- public virtual async Task> PagingAsync(
- string filter = null,
- int maxResultCount = 10,
- int skipCount = 0)
- {
- return await _fileRepository.GetPagingListAsync(filter, maxResultCount, skipCount);
- }
-
-
- public virtual async Task CountAsync(string filter = null)
- {
- return await _fileRepository.GetPagingCountAsync(filter);
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
new file mode 100644
index 00000000..80ef6af4
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
@@ -0,0 +1,137 @@
+using Lion.AbpPro.Core;
+
+namespace Lion.AbpPro.FileManagement.Files;
+
+///
+/// 文件
+///
+public class FileObject : FullAuditedAggregateRoot, IMultiTenant
+{
+
+
+ public FileObject(
+ Guid id,
+ string providerKey,
+ byte[] bytes,
+ long fileSize,
+ string contentType,
+ string fileName,
+ Guid? tenantId = null
+ ) : base(id)
+ {
+ SetProviderKey(providerKey);
+ SetBytes(bytes);
+ SetFileSize(fileSize);
+ SetContentType(contentType);
+ SetFileName(fileName);
+ TenantId = tenantId;
+ }
+
+ public Guid? TenantId { get; private set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string FileName { get; private set; }
+
+ ///
+ /// 文件名称
+ ///
+ public string ContentType { get; private set; }
+
+
+ ///
+ /// 文件大小
+ ///
+ public long FileSize { get; private set; }
+
+
+ ///
+ /// 文件扩展名
+ ///
+ public string FileExtension { get; private set; }
+
+ ///
+ /// 二进制数据
+ ///
+ public byte[] Bytes { get; private set; }
+
+ ///
+ /// 文件Provider
+ ///
+ public string ProviderKey { get; private set; }
+
+
+ ///
+ /// 设置文件Provider
+ ///
+ private void SetProviderKey(string providerKey)
+ {
+ Guard.NotNullOrWhiteSpace(providerKey, nameof(providerKey), 128, 0);
+ ProviderKey = providerKey;
+ }
+
+ ///
+ /// 设置文件扩展名
+ ///
+ private void SetFileExtension(string fileExtension)
+ {
+ Guard.NotNullOrWhiteSpace(fileExtension, nameof(fileExtension), 36, 0);
+ FileExtension = fileExtension;
+ }
+
+ ///
+ /// 设置二进制数据
+ ///
+ private void SetBytes(byte[] bytes)
+ {
+ Bytes = bytes;
+ }
+
+ ///
+ /// 设置文件大小
+ ///
+ private void SetFileSize(long fileSize)
+ {
+ FileSize = fileSize;
+ }
+
+ ///
+ /// 设置文件名称
+ ///
+ private void SetContentType(string contentType)
+ {
+ Guard.NotNullOrWhiteSpace(contentType, nameof(contentType), 128, 0);
+ ContentType = contentType;
+ }
+
+ ///
+ /// 设置文件名称
+ ///
+ private void SetFileName(string fileName)
+ {
+ Guard.NotNullOrWhiteSpace(fileName, nameof(fileName), 128, 0);
+ SetFileExtension(Path.GetExtension(fileName));
+ FileName = fileName;
+ }
+
+ ///
+ /// 更新文件
+ ///
+ public void Update(
+ string providerKey,
+ string fileExtension,
+ byte[] bytes,
+ long fileSize,
+ string contentType,
+ string fileName
+ )
+ {
+ SetProviderKey(providerKey);
+ SetFileExtension(fileExtension);
+ SetBytes(bytes);
+ SetFileSize(fileSize);
+ SetContentType(contentType);
+ SetFileName(fileName);
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
new file mode 100644
index 00000000..802ae5c3
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
@@ -0,0 +1,65 @@
+using Volo.Abp.ObjectMapping;
+
+namespace Lion.AbpPro.FileManagement.Files;
+
+public class FileObjectManager : DomainService
+{
+ private readonly IFileObjectRepository _fileObjectRepository;
+ private readonly IObjectMapper _objectMapper;
+ private readonly ICurrentTenant _currentTenant;
+
+ public FileObjectManager(IFileObjectRepository iIFileObjectRepository, IObjectMapper objectMapper, ICurrentTenant currentTenant)
+ {
+ _fileObjectRepository = iIFileObjectRepository;
+ _objectMapper = objectMapper;
+ _currentTenant = currentTenant;
+ }
+
+ public async Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0)
+ {
+ return await _fileObjectRepository.GetListAsync(fileName, startDateTime, endDateTime, maxResultCount, skipCount);
+ }
+
+ public async Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null)
+ {
+ return await _fileObjectRepository.GetCountAsync(fileName, startDateTime, endDateTime);
+ }
+
+ ///
+ /// 创建文件
+ ///
+ public async Task CreateAsync(
+ Guid id,
+ string fileName,
+ byte[] bytes,
+ long fileSize,
+ string contentType,
+ string providerKey
+ )
+ {
+ var entity = new FileObject(id, providerKey, bytes, fileSize, contentType, fileName, _currentTenant.Id);
+ entity = await _fileObjectRepository.InsertAsync(entity);
+ return _objectMapper.Map(entity);
+ }
+
+
+ ///
+ /// 删除文件
+ ///
+ public async Task DeleteAsync(Guid id)
+ {
+ var entity = await _fileObjectRepository.FindAsync(id);
+ if (entity == null) throw new UserFriendlyException($"文件不存在");
+ await _fileObjectRepository.DeleteAsync(entity);
+ }
+
+ ///
+ /// 删除文件
+ ///
+ public async Task GetAsync(Guid id)
+ {
+ var entity = await _fileObjectRepository.FindAsync(id);
+ if (entity == null) throw new UserFriendlyException($"文件不存在");
+ return _objectMapper.Map(entity);
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileManager.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileManager.cs
deleted file mode 100644
index 26204afc..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileManager.cs
+++ /dev/null
@@ -1,15 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public interface IFileManager
-{
- Task CreateAsync(string fileName, string filePath);
-
- Task> PagingAsync(
- string filter = null,
- int maxResultCount = 10,
- int skipCount = 0);
-
- Task CountAsync(string filter = null);
- IAbpLazyServiceProvider LazyServiceProvider { get; set; }
- IServiceProvider ServiceProvider { get; set; }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
new file mode 100644
index 00000000..a9dc2c00
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
@@ -0,0 +1,8 @@
+namespace Lion.AbpPro.FileManagement.Files;
+
+public interface IFileObjectRepository : IBasicRepository
+{
+ Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0);
+
+ Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null);
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileRepository.cs
deleted file mode 100644
index 74fe7b8e..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileRepository.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-namespace Lion.AbpPro.FileManagement.Files;
-
-public interface IFileRepository: IRepository
-{
- Task> GetPagingListAsync(
- string filter = null,
- int maxResultCount = 10,
- int skipCount = 0,
- CancellationToken cancellationToken = default);
-
- Task GetPagingCountAsync(string filter = null,
- CancellationToken cancellationToken = default);
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
index 1ff1c6b8..fd901280 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
@@ -8,6 +8,7 @@
+
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs
new file mode 100644
index 00000000..14a3ca39
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs
@@ -0,0 +1,30 @@
+using Lion.AbpPro.FileManagement.Files;
+using Volo.Abp.Guids;
+
+namespace Lion.AbpPro.FileManagement.Provider;
+
+public class DatabaseFileProvider : IFileProvider, ITransientDependency
+{
+ public const string Name = nameof(DatabaseFileProvider);
+ private readonly FileObjectManager _fileObjectManager;
+ private readonly IGuidGenerator _guidGenerator;
+
+ public DatabaseFileProvider(FileObjectManager fileObjectManager, IGuidGenerator guidGenerator)
+ {
+ _fileObjectManager = fileObjectManager;
+ _guidGenerator = guidGenerator;
+ }
+
+ public async Task UploadAsync(UpdateDto input)
+ {
+ var id = _guidGenerator.Create();
+ var fileName = id + "_" + input.FileName;
+ await _fileObjectManager.CreateAsync(id, fileName, input.Bytes, input.FileSize, input.ContentType, Name);
+ return new UpdateResult()
+ {
+ Id = id,
+ FileName = fileName,
+ FilePath = fileName
+ };
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs
new file mode 100644
index 00000000..a2823bc4
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs
@@ -0,0 +1,6 @@
+namespace Lion.AbpPro.FileManagement.Provider;
+
+public interface IFileProvider
+{
+ Task UploadAsync(UpdateDto input);
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs
index 170a8d32..dfbe1977 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs
@@ -19,5 +19,5 @@ public class FileManagementDbContext : AbpDbContext, IF
builder.ConfigureFileManagement();
}
- public DbSet Files { get; }
+ public DbSet FileObjects { get; set; }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
index 59439e9e..d64637b1 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
@@ -8,11 +8,16 @@ public static class FileManagementDbContextModelCreatingExtensions
Check.NotNull(builder, nameof(builder));
- builder.Entity(b =>
+ builder.Entity(b =>
{
- b.ToTable(FileManagementDbProperties.DbTablePrefix + nameof(Lion.AbpPro.FileManagement.Files.File), FileManagementDbProperties.DbSchema);
- b.HasIndex(q => q.FileName);
- b.HasIndex(q => q.CreationTime);
+ b.ToTable(FileManagementDbProperties.DbTablePrefix + "FileObjects");
+ b.Property(e => e.ProviderKey).IsRequired().HasMaxLength(128).HasComment("文件Provider");
+ b.Property(e => e.FileExtension).IsRequired().HasMaxLength(36).HasComment("文件扩展名");
+ b.Property(e => e.Bytes).HasComment("二进制数据");
+ b.Property(e => e.FileSize).HasComment("文件大小");
+ b.Property(e => e.ContentType).IsRequired().HasMaxLength(128).HasComment("文件名称");
+ b.Property(e => e.FileName).IsRequired().HasMaxLength(128).HasComment("文件名称");
+ b.HasIndex(e => e.FileName);
b.ConfigureByConvention();
});
}
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
new file mode 100644
index 00000000..c48fd497
--- /dev/null
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
@@ -0,0 +1,49 @@
+using System.Linq.Dynamic.Core;
+using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
+using Volo.Abp.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+
+namespace Lion.AbpPro.FileManagement.EntityFrameworkCore.Files;
+
+///
+/// 文件 仓储Ef core 实现
+///
+public class EfCoreFileObjectRepository :
+ EfCoreRepository,
+ IFileObjectRepository
+{
+ public EfCoreFileObjectRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
+ {
+ }
+
+ public async Task> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null,int maxResultCount = 10, int skipCount = 0)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(fileName.IsNotNullOrWhiteSpace(),e=>e.FileName.Contains(fileName))
+ .WhereIf(startDateTime.HasValue, e => e.CreationTime >= startDateTime.Value)
+ .WhereIf(endDateTime.HasValue, e => e.CreationTime <= endDateTime.Value)
+ .OrderByDescending(e => e.CreationTime)
+ .PageBy(skipCount, maxResultCount)
+ .Select(e => new FileObjectDto
+ {
+
+ Id = e.Id,
+ CreationTime = e.CreationTime,
+ FileName = e.FileName,
+ FileSize = e.FileSize,
+ FileExtension = e.FileExtension,
+ ContentType = e.ContentType,
+ ProviderKey = e.ProviderKey
+ }) // 选择指定字段
+ .ToListAsync();
+ }
+
+ public async Task GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null)
+ {
+ return await (await GetDbSetAsync())
+ .WhereIf(fileName.IsNotNullOrWhiteSpace(),e=>e.FileName.Contains(fileName))
+ .WhereIf(startDateTime.HasValue, e => e.CreationTime >= startDateTime.Value)
+ .WhereIf(endDateTime.HasValue, e => e.CreationTime <= endDateTime.Value)
+ .CountAsync();
+ }
+}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileRepository.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileRepository.cs
deleted file mode 100644
index 3717bdd9..00000000
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileRepository.cs
+++ /dev/null
@@ -1,31 +0,0 @@
-namespace Lion.AbpPro.FileManagement.EntityFrameworkCore.Files;
-
-public class EfCoreFileRepository: EfCoreRepository, IFileRepository
-{
- public EfCoreFileRepository(IDbContextProvider dbContextProvider) : base(dbContextProvider)
- {
- }
-
- public async Task> GetPagingListAsync(
- string filter = null,
- int maxResultCount = 10,
- int skipCount = 0,
- CancellationToken cancellationToken = default)
- {
- return await (await GetDbSetAsync())
- .WhereIf(!filter.IsNullOrWhiteSpace(),
- e => (e.FileName.Contains(filter)))
- .OrderByDescending(e => e.CreationTime)
- .PageBy(skipCount, maxResultCount)
- .ToListAsync(GetCancellationToken(cancellationToken));
- }
-
- public async Task GetPagingCountAsync(string filter = null,
- CancellationToken cancellationToken = default)
- {
- return await (await GetDbSetAsync())
- .WhereIf(!filter.IsNullOrWhiteSpace(),
- e => (e.FileName.Contains(filter)))
- .CountAsync(cancellationToken: cancellationToken);
- }
-}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/IFileManagementDbContext.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/IFileManagementDbContext.cs
index 62445d0d..6a3a43c8 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/IFileManagementDbContext.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/IFileManagementDbContext.cs
@@ -1,4 +1,6 @@
-namespace Lion.AbpPro.FileManagement.EntityFrameworkCore;
+
+
+namespace Lion.AbpPro.FileManagement.EntityFrameworkCore;
[ConnectionStringName(FileManagementDbProperties.ConnectionStringName)]
public interface IFileManagementDbContext : IEfCoreDbContext
@@ -6,5 +8,5 @@ public interface IFileManagementDbContext : IEfCoreDbContext
/* Add DbSet for each Aggregate Root here. Example:
* DbSet Questions { get; }
*/
- DbSet Files { get; }
+ DbSet FileObjects { get; }
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj
index 996eede7..856f4155 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj
@@ -7,7 +7,6 @@
-
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
index e4e78dab..b310fb34 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
@@ -1,7 +1,9 @@
-namespace Lion.AbpPro.FileManagement.Files;
+using Microsoft.AspNetCore.Http;
+
+namespace Lion.AbpPro.FileManagement.Files;
[Route("Files")]
-public class FileController: FileManagementController, IFileAppService
+public class FileController : AbpController, IFileAppService
{
private readonly IFileAppService _fileAppService;
@@ -10,24 +12,39 @@ public class FileController: FileManagementController, IFileAppService
_fileAppService = fileAppService;
}
- [HttpGet("getFileToken")]
- [SwaggerOperation(summary: "获取上传文件临时Token", Tags = new[] { "Files" })]
- public Task GetFileTokenAsync()
+ [HttpPost("Page")]
+ [SwaggerOperation(summary: "分页查询文件", Tags = new[] { "Files" })]
+ public async Task> PageAsync(PageFileObjectInput input)
+ {
+ return await _fileAppService.PageAsync(input);
+ }
+
+ [HttpPost("Upload")]
+ [SwaggerOperation(summary: "上传文件", Tags = new[] { "Files" })]
+ public async Task> UploadAsync(List files)
+ {
+ return await _fileAppService.UploadAsync(files);
+ }
+
+
+ [HttpPost("Delete")]
+ [SwaggerOperation(summary: "删除文件", Tags = new[] { "Files" })]
+ public async Task DeleteAsync(DeleteFileObjectInput input)
{
- return _fileAppService.GetFileTokenAsync();
+ await _fileAppService.DeleteAsync(input);
}
- [HttpPost("create")]
- [SwaggerOperation(summary: "创建文件", Tags = new[] { "Files" })]
- public Task CreateAsync(CreateFileInput input)
+ [HttpPost("Get")]
+ [SwaggerOperation(summary: "获取文件", Tags = new[] { "Files" })]
+ public Task GetAsync(GetFileObjectInput input)
{
- return _fileAppService.CreateAsync(input);
+ return _fileAppService.GetAsync(input);
}
- [HttpPost("page")]
- [SwaggerOperation(summary: "分页查询", Tags = new[] { "Files" })]
- public Task> PagingAsync(PagingFileInput input)
+ [HttpPost("Download")]
+ [SwaggerOperation(summary: "下载文件", Tags = new[] { "Files" })]
+ public Task DownloadAsync(DownloadFileObjectInput input)
{
- return _fileAppService.PagingAsync(input);
+ return _fileAppService.DownloadAsync(input);
}
}
\ No newline at end of file
diff --git a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/GlobalUsings.cs b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/GlobalUsings.cs
index 047f7177..c40490ab 100644
--- a/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/GlobalUsings.cs
+++ b/aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/GlobalUsings.cs
@@ -1,7 +1,6 @@
// Global using directives
global using System.Threading.Tasks;
-global using Lion.AbpPro.FileManagement.Files.Dto;
global using Lion.AbpPro.FileManagement.Localization;
global using Localization.Resources.AbpUi;
global using Microsoft.AspNetCore.Mvc;
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
index 247fffe5..490e955f 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
@@ -76,13 +76,19 @@ namespace Lion.AbpPro
app.UseAuditing();
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
- app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
- // app.UseHangfireDashboard("/hangfire", new DashboardOptions()
- // {
- // Authorization = new[] { new CustomHangfireAuthorizeFilter() },
- // IgnoreAntiforgeryToken = true
- // });
+
+ app.UseConfiguredEndpoints(endpoints =>
+ {
+ endpoints.MapHealthChecks("/health");
+
+ // endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
+ // {
+ // Authorization = new[] { new CustomHangfireAuthorizeFilter() },
+ // IgnoreAntiforgeryToken = true
+ // });
+ });
+
if (configuration.GetValue("Consul:Enabled", false))
{
app.UseConsul();
diff --git a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
index babf199f..e28b7837 100644
--- a/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
+++ b/aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
@@ -34,7 +34,7 @@
"CorsOrigins": "https://*.AbpPro.com,http://localhost:4200,http://localhost:3100"
},
"ConnectionStrings": {
- "Default": "Data Source=localhost;Port=3306;Database=LionAbpProDemo9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
+ "Default": "Data Source=localhost;Port=3306;Database=LionAbpPro9;uid=root;pwd=1q2w3E*;charset=utf8mb4;Allow User Variables=true;AllowLoadLocalInfile=true"
},
"Hangfire": {
"Redis": {
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/AbpProApplicationContractsModule.cs b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/AbpProApplicationContractsModule.cs
index 053f2351..85fa9f49 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/AbpProApplicationContractsModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/AbpProApplicationContractsModule.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.FileManagement;
+
namespace Lion.AbpPro
{
[DependsOn(
@@ -6,7 +8,8 @@ namespace Lion.AbpPro
typeof(BasicManagementApplicationContractsModule),
typeof(DataDictionaryManagementApplicationContractsModule),
typeof(LanguageManagementApplicationContractsModule),
- typeof(NotificationManagementApplicationContractsModule)
+ typeof(NotificationManagementApplicationContractsModule),
+ typeof(FileManagementApplicationContractsModule)
)]
public class AbpProApplicationContractsModule : AbpModule
{
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj
index 553b7a21..6b3fc8ff 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj
@@ -7,6 +7,7 @@
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs b/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs
index 59f0e29a..c18a07b5 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.FileManagement;
+
namespace Lion.AbpPro
{
[DependsOn(
@@ -8,6 +10,7 @@ namespace Lion.AbpPro
typeof(NotificationManagementApplicationModule),
typeof(LanguageManagementApplicationModule),
typeof(NotificationManagementApplicationModule),
+ typeof(FileManagementApplicationModule),
typeof(AbpProFreeSqlModule)
)]
public class AbpProApplicationModule : AbpModule
diff --git a/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj b/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
index 5dd15c1c..cdebdd2e 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
@@ -9,6 +9,7 @@
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
index 6284e871..3919db4f 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
@@ -1,6 +1,7 @@
using Lion.AbpPro.BasicManagement;
using Lion.AbpPro.BasicManagement.Localization;
using Lion.AbpPro.Core;
+using Lion.AbpPro.FileManagement;
using Lion.AbpPro.LanguageManagement;
namespace Lion.AbpPro
@@ -10,7 +11,8 @@ namespace Lion.AbpPro
typeof(BasicManagementDomainSharedModule),
typeof(DataDictionaryManagementDomainSharedModule),
typeof(NotificationManagementDomainSharedModule),
- typeof(LanguageManagementDomainSharedModule)
+ typeof(LanguageManagementDomainSharedModule),
+ typeof(FileManagementDomainSharedModule)
)]
public class AbpProDomainSharedModule : AbpModule
{
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj
index 4d5643d0..327704aa 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj
@@ -17,6 +17,7 @@
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs b/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
index 9e1ef5cb..1a16fba8 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
@@ -1,3 +1,5 @@
+using Lion.AbpPro.FileManagement;
+
namespace Lion.AbpPro
{
[DependsOn(
@@ -6,7 +8,8 @@ namespace Lion.AbpPro
typeof(BasicManagementDomainModule),
typeof(DataDictionaryManagementDomainModule),
typeof(NotificationManagementDomainModule),
- typeof(LanguageManagementDomainModule)
+ typeof(LanguageManagementDomainModule),
+ typeof(FileManagementDomainModule)
)]
public class AbpProDomainModule : AbpModule
{
diff --git a/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj b/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj
index 2b8530de..b785a1ba 100644
--- a/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj
@@ -10,6 +10,7 @@
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs
index 6e1a0faf..a5c259b1 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs
@@ -1,9 +1,10 @@
using Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates;
+using Lion.AbpPro.FileManagement.EntityFrameworkCore;
+using Lion.AbpPro.FileManagement.Files;
using Lion.AbpPro.LanguageManagement.EntityFrameworkCore;
using Lion.AbpPro.LanguageManagement.Languages.Aggregates;
using Lion.AbpPro.LanguageManagement.LanguageTexts.Aggregates;
using Lion.AbpPro.NotificationManagement.Notifications.Aggregates;
-
namespace Lion.AbpPro.EntityFrameworkCore
{
/* This is your actual DbContext used on runtime.
@@ -20,7 +21,8 @@ namespace Lion.AbpPro.EntityFrameworkCore
IBasicManagementDbContext,
INotificationManagementDbContext,
IDataDictionaryManagementDbContext,
- ILanguageManagementDbContext
+ ILanguageManagementDbContext,
+ IFileManagementDbContext
{
public DbSet Users { get; set; }
public DbSet Roles { get; set; }
@@ -47,6 +49,7 @@ namespace Lion.AbpPro.EntityFrameworkCore
public DbSet DataDictionaries { get; set; }
public DbSet Languages { get; set; }
public DbSet LanguageTexts { get; set; }
+ public DbSet FileObjects { get; set; }
public AbpProDbContext(DbContextOptions options)
: base(options)
@@ -80,7 +83,12 @@ namespace Lion.AbpPro.EntityFrameworkCore
// 多语言
builder.ConfigureLanguageManagement();
+
+ // 文件模块
+ builder.ConfigureFileManagement();
}
+
+
}
}
\ No newline at end of file
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
index e27af402..5d497316 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
@@ -1,3 +1,4 @@
+using Lion.AbpPro.FileManagement.EntityFrameworkCore;
using Lion.AbpPro.LanguageManagement.EntityFrameworkCore;
using Volo.Abp.Guids;
@@ -9,7 +10,8 @@ namespace Lion.AbpPro.EntityFrameworkCore
typeof(AbpEntityFrameworkCoreMySQLModule),
typeof(DataDictionaryManagementEntityFrameworkCoreModule),
typeof(NotificationManagementEntityFrameworkCoreModule),
- typeof(LanguageManagementEntityFrameworkCoreModule)
+ typeof(LanguageManagementEntityFrameworkCoreModule),
+ typeof(FileManagementEntityFrameworkCoreModule)
)]
public class AbpProEntityFrameworkCoreModule : AbpModule
{
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
index da9df8f0..131f41d5 100644
--- a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
@@ -9,6 +9,7 @@
+
diff --git a/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.Designer.cs b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.Designer.cs
new file mode 100644
index 00000000..aa1b3ee7
--- /dev/null
+++ b/aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.Designer.cs
@@ -0,0 +1,2179 @@
+//
+using System;
+using Lion.AbpPro.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore;
+using Microsoft.EntityFrameworkCore.Infrastructure;
+using Microsoft.EntityFrameworkCore.Metadata;
+using Microsoft.EntityFrameworkCore.Migrations;
+using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
+using Volo.Abp.EntityFrameworkCore;
+
+#nullable disable
+
+namespace Lion.AbpPro.Migrations
+{
+ [DbContext(typeof(AbpProDbContext))]
+ [Migration("20250215074519_1.0.2")]
+ partial class _102
+ {
+ ///
+ protected override void BuildTargetModel(ModelBuilder modelBuilder)
+ {
+#pragma warning disable 612, 618
+ modelBuilder
+ .HasAnnotation("_Abp_DatabaseProvider", EfCoreDatabaseProvider.MySql)
+ .HasAnnotation("ProductVersion", "9.0.0")
+ .HasAnnotation("Relational:MaxIdentifierLength", 64);
+
+ MySqlModelBuilderExtensions.AutoIncrementColumns(modelBuilder);
+
+ modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionary", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Code")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("Description")
+ .IsRequired()
+ .HasMaxLength(1024)
+ .HasColumnType("varchar(1024)");
+
+ b.Property("DisplayText")
+ .IsRequired()
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpDataDictionaries", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.DataDictionaryManagement.DataDictionaries.Aggregates.DataDictionaryDetail", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Code")
+ .HasColumnType("longtext");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DataDictionaryId")
+ .HasColumnType("char(36)");
+
+ b.Property("Description")
+ .HasColumnType("longtext");
+
+ b.Property("DisplayText")
+ .HasColumnType("longtext");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Order")
+ .HasColumnType("int");
+
+ b.HasKey("Id");
+
+ b.HasIndex("DataDictionaryId");
+
+ b.ToTable("AbpDataDictionaryDetails", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.FileManagement.Files.FileObject", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("Bytes")
+ .HasColumnType("longblob")
+ .HasComment("二进制数据");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("ContentType")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("文件名称");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FileExtension")
+ .IsRequired()
+ .HasMaxLength(36)
+ .HasColumnType("varchar(36)")
+ .HasComment("文件扩展名");
+
+ b.Property("FileName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("文件名称");
+
+ b.Property("FileSize")
+ .HasColumnType("bigint")
+ .HasComment("文件大小");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("ProviderKey")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("文件Provider");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("FileName");
+
+ b.ToTable("AbpFileObjects", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.LanguageManagement.LanguageTexts.Aggregates.LanguageText", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("语言名称");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasComment("名称");
+
+ b.Property("ResourceName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("资源名称");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("Value")
+ .IsRequired()
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasComment("值");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ResourceName", "CultureName");
+
+ b.ToTable("AbpLanguageTexts", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.LanguageManagement.Languages.Aggregates.Language", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("CultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("语言名称");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("DisplayName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("显示名称");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("FlagIcon")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("图标");
+
+ b.Property("IsDefault")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("IsEnabled")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("UiCultureName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasComment("Ui语言名称");
+
+ b.HasKey("Id");
+
+ b.HasIndex("CultureName");
+
+ b.ToTable("AbpLanguages", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.Notification", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("Content")
+ .IsRequired()
+ .HasMaxLength(1024)
+ .HasColumnType("varchar(1024)");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("MessageLevel")
+ .HasColumnType("int");
+
+ b.Property("MessageType")
+ .HasColumnType("int");
+
+ b.Property("Read")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ReadTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ReceiveUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("ReceiveUserName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("SenderUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("SenderUserName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("Title")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.HasKey("Id");
+
+ b.ToTable("AbpNotifications", (string)null);
+ });
+
+ modelBuilder.Entity("Lion.AbpPro.NotificationManagement.Notifications.Aggregates.NotificationSubscription", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CreationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("CreationTime");
+
+ b.Property("CreatorId")
+ .HasColumnType("char(36)")
+ .HasColumnName("CreatorId");
+
+ b.Property("DeleterId")
+ .HasColumnType("char(36)")
+ .HasColumnName("DeleterId");
+
+ b.Property("DeletionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("DeletionTime");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("IsDeleted")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("tinyint(1)")
+ .HasDefaultValue(false)
+ .HasColumnName("IsDeleted");
+
+ b.Property("LastModificationTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("LastModificationTime");
+
+ b.Property("LastModifierId")
+ .HasColumnType("char(36)")
+ .HasColumnName("LastModifierId");
+
+ b.Property("NotificationId")
+ .HasColumnType("char(36)");
+
+ b.Property("Read")
+ .HasColumnType("tinyint(1)");
+
+ b.Property("ReadTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ReceiveUserId")
+ .HasColumnType("char(36)");
+
+ b.Property("ReceiveUserName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("NotificationId");
+
+ b.HasIndex("ReceiveUserId");
+
+ b.ToTable("AbpNotificationSubscriptions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLog", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("ApplicationName")
+ .HasMaxLength(96)
+ .HasColumnType("varchar(96)")
+ .HasColumnName("ApplicationName");
+
+ b.Property("BrowserInfo")
+ .HasMaxLength(512)
+ .HasColumnType("varchar(512)")
+ .HasColumnName("BrowserInfo");
+
+ b.Property("ClientId")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ClientId");
+
+ b.Property("ClientIpAddress")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ClientIpAddress");
+
+ b.Property("ClientName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("ClientName");
+
+ b.Property("Comments")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("Comments");
+
+ b.Property("ConcurrencyStamp")
+ .IsConcurrencyToken()
+ .IsRequired()
+ .HasMaxLength(40)
+ .HasColumnType("varchar(40)")
+ .HasColumnName("ConcurrencyStamp");
+
+ b.Property("CorrelationId")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("CorrelationId");
+
+ b.Property("Exceptions")
+ .HasColumnType("longtext");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime(6)");
+
+ b.Property("ExtraProperties")
+ .IsRequired()
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("HttpMethod")
+ .HasMaxLength(16)
+ .HasColumnType("varchar(16)")
+ .HasColumnName("HttpMethod");
+
+ b.Property("HttpStatusCode")
+ .HasColumnType("int")
+ .HasColumnName("HttpStatusCode");
+
+ b.Property("ImpersonatorTenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("ImpersonatorTenantId");
+
+ b.Property("ImpersonatorTenantName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("ImpersonatorTenantName");
+
+ b.Property("ImpersonatorUserId")
+ .HasColumnType("char(36)")
+ .HasColumnName("ImpersonatorUserId");
+
+ b.Property("ImpersonatorUserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("ImpersonatorUserName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.Property("TenantName")
+ .HasMaxLength(64)
+ .HasColumnType("varchar(64)")
+ .HasColumnName("TenantName");
+
+ b.Property("Url")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("Url");
+
+ b.Property("UserId")
+ .HasColumnType("char(36)")
+ .HasColumnName("UserId");
+
+ b.Property("UserName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("UserName");
+
+ b.HasKey("Id");
+
+ b.HasIndex("TenantId", "ExecutionTime");
+
+ b.HasIndex("TenantId", "UserId", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogs", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.AuditLogAction", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("AuditLogId")
+ .HasColumnType("char(36)")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ExecutionDuration")
+ .HasColumnType("int")
+ .HasColumnName("ExecutionDuration");
+
+ b.Property("ExecutionTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("ExecutionTime");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("MethodName")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("MethodName");
+
+ b.Property("Parameters")
+ .HasMaxLength(2000)
+ .HasColumnType("varchar(2000)")
+ .HasColumnName("Parameters");
+
+ b.Property("ServiceName")
+ .HasMaxLength(256)
+ .HasColumnType("varchar(256)")
+ .HasColumnName("ServiceName");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "ServiceName", "MethodName", "ExecutionTime");
+
+ b.ToTable("AbpAuditLogActions", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityChange", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property("AuditLogId")
+ .HasColumnType("char(36)")
+ .HasColumnName("AuditLogId");
+
+ b.Property("ChangeTime")
+ .HasColumnType("datetime(6)")
+ .HasColumnName("ChangeTime");
+
+ b.Property("ChangeType")
+ .HasColumnType("tinyint unsigned")
+ .HasColumnName("ChangeType");
+
+ b.Property("EntityId")
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("EntityId");
+
+ b.Property("EntityTenantId")
+ .HasColumnType("char(36)");
+
+ b.Property("EntityTypeFullName")
+ .IsRequired()
+ .HasMaxLength(128)
+ .HasColumnType("varchar(128)")
+ .HasColumnName("EntityTypeFullName");
+
+ b.Property("ExtraProperties")
+ .HasColumnType("longtext")
+ .HasColumnName("ExtraProperties");
+
+ b.Property("TenantId")
+ .HasColumnType("char(36)")
+ .HasColumnName("TenantId");
+
+ b.HasKey("Id");
+
+ b.HasIndex("AuditLogId");
+
+ b.HasIndex("TenantId", "EntityTypeFullName", "EntityId");
+
+ b.ToTable("AbpEntityChanges", (string)null);
+ });
+
+ modelBuilder.Entity("Volo.Abp.AuditLogging.EntityPropertyChange", b =>
+ {
+ b.Property("Id")
+ .HasColumnType("char(36)");
+
+ b.Property