Browse Source

Merge remote-tracking branch 'origin/main' into feat/cli-code

feat/cap
Hanpaopao 1 year ago
parent
commit
d68b4effe1
  1. 38
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs
  2. 12
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DeleteFileObjectInput.cs
  3. 9
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DownloadFileObjectInput.cs
  4. 8
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/CreateFileInput.cs
  5. 19
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/FileTokenOutput.cs
  6. 14
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingFileOutput.cs
  7. 6
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingInput.cs
  8. 9
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectInput.cs
  9. 44
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/GetFileObjectOutput.cs
  10. 31
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/IFileAppService.cs
  11. 22
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectInput.cs
  12. 47
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs
  13. 43
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs
  14. 13
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UploadOutput.cs
  15. 2
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj
  16. 5
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Permissions/FileManagementPermissionDefinitionProvider.cs
  17. 5
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationAutoMapperProfile.cs
  18. 27
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/FileManagementApplicationModule.cs
  19. 127
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Files/FileAppService.cs
  20. 6
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/GlobalUsings.cs
  21. 2
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj
  22. 51
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs
  23. 26
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateDto.cs
  24. 17
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Provider/UpdateResult.cs
  25. 2
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDbProperties.cs
  26. 13
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainAutoMapperProfile.cs
  27. 7
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/FileManagementDomainModule.cs
  28. 22
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/Aggregates/File.cs
  29. 33
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs
  30. 137
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObject.cs
  31. 65
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileObjectManager.cs
  32. 15
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileManager.cs
  33. 8
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileObjectRepository.cs
  34. 13
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileRepository.cs
  35. 1
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj
  36. 30
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/DatabaseFileProvider.cs
  37. 6
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Provider/IFileProvider.cs
  38. 2
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs
  39. 13
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContextModelCreatingExtensions.cs
  40. 49
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileObjectRepository.cs
  41. 31
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileRepository.cs
  42. 6
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/IFileManagementDbContext.cs
  43. 1
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj
  44. 45
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/Files/FileController.cs
  45. 1
      aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.HttpApi/GlobalUsings.cs
  46. 10
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/AbpProHttpApiHostModule.cs
  47. 2
      aspnet-core/services/host/Lion.AbpPro.HttpApi.Host/appsettings.json
  48. 5
      aspnet-core/services/src/Lion.AbpPro.Application.Contracts/AbpProApplicationContractsModule.cs
  49. 1
      aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj
  50. 3
      aspnet-core/services/src/Lion.AbpPro.Application/AbpProApplicationModule.cs
  51. 1
      aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj
  52. 4
      aspnet-core/services/src/Lion.AbpPro.Domain.Shared/AbpProDomainSharedModule.cs
  53. 1
      aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj
  54. 5
      aspnet-core/services/src/Lion.AbpPro.Domain/AbpProDomainModule.cs
  55. 1
      aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj
  56. 12
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProDbContext.cs
  57. 4
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/EntityFrameworkCore/AbpProEntityFrameworkCoreModule.cs
  58. 1
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj
  59. 2179
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.Designer.cs
  60. 61
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.cs
  61. 90
      aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs
  62. 4
      aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs
  63. 1
      aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj
  64. 4
      aspnet-core/services/src/Lion.AbpPro.HttpApi/AbpProHttpApiModule.cs
  65. 1
      aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj
  66. 12
      templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs

38
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/CreateFileObjectInput.cs

@ -0,0 +1,38 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 创建文件
/// </summary>
public class CreateFileObjectInput
{
/// <summary>
/// 文件Provider
/// </summary>
[Required(ErrorMessage = "文件Provider不能为空")]
public string ProviderKey { get; set; }
/// <summary>
/// 文件扩展名
/// </summary>
[Required(ErrorMessage = "文件扩展名不能为空")]
public string FileExtension { get; set; }
/// <summary>
/// 二进制数据
/// </summary>
[Required(ErrorMessage = "二进制数据不能为空")]
public long Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
[Required(ErrorMessage = "文件大小不能为空")]
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
[Required(ErrorMessage = "文件名称不能为空")]
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
[Required(ErrorMessage = "文件名称不能为空")]
public string FileName { get; set; }
}

12
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/DeleteFileObjectInput.cs

@ -0,0 +1,12 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 删除文件
/// </summary>
public class DeleteFileObjectInput
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
}

9
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
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
}

8
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/CreateFileInput.cs

@ -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; }
}

19
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/FileTokenOutput.cs

@ -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; }
/// <summary>
/// 过期时间
/// </summary>
public string Expiration { get; set; }
public string Bucket { get; set; }
public string Region { get; set; }
}

14
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingFileOutput.cs

@ -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; }
}

6
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/Dto/PagingInput.cs

@ -1,6 +0,0 @@
namespace Lion.AbpPro.FileManagement.Files.Dto;
public class PagingFileInput : PagingBase
{
public string Filter { get; set; }
}

9
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
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
}

44
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
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 文件Provider
/// </summary>
public string ProviderKey { get; set; }
/// <summary>
/// 文件扩展名
/// </summary>
public string FileExtension { get; set; }
/// <summary>
/// 二进制数据
/// </summary>
public byte[] Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; }
}

31
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;
/// <summary>
/// 文件
/// </summary>
public interface IFileAppService : IApplicationService
{
Task<FileTokenOutput> GetFileTokenAsync();
Task CreateAsync(CreateFileInput input);
/// <summary>
/// 分页查询文件
/// </summary>
Task<PagedResultDto<PageFileObjectOutput>> PageAsync(PageFileObjectInput input);
Task<PagedResultDto<PagingFileOutput>> PagingAsync(PagingFileInput input);
/// <summary>
/// 上传文件
/// </summary>
Task<List<UploadOutput>> UploadAsync(List<IFormFile> files);
/// <summary>
/// 删除文件
/// </summary>
Task DeleteAsync(DeleteFileObjectInput input);
Task<GetFileObjectOutput> GetAsync(GetFileObjectInput input);
/// <summary>
/// 下载文件
/// </summary>
Task<FileContentResult> DownloadAsync(DownloadFileObjectInput input);
}

22
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectInput.cs

@ -0,0 +1,22 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 分页查询文件
/// </summary>
public class PageFileObjectInput : PagingBase
{
/// <summary>
/// 开始创建时间
/// </summary>
public DateTime? StartCreationTime { get; set; }
/// <summary>
/// 结束创建时间
/// </summary>
public DateTime? EndCreationTime { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
}

47
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/PageFileObjectOutput.cs

@ -0,0 +1,47 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 分页查询文件
/// </summary>
public class PageFileObjectOutput
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 文件Provider
/// </summary>
public string ProviderKey { get; set; }
/// <summary>
/// 文件扩展名
/// </summary>
public string FileExtension { get; set; }
// /// <summary>
// /// 二进制数据
// /// </summary>
// public byte[] Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; }
}

43
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Files/UpdateFileInput.cs

@ -0,0 +1,43 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 更新文件
/// </summary>
public class UpdateFileInput
{
/// <summary>
/// 文件Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 文件Provider
/// </summary>
[Required(ErrorMessage = "文件Provider不能为空")]
public string ProviderKey { get; set; }
/// <summary>
/// 文件扩展名
/// </summary>
[Required(ErrorMessage = "文件扩展名不能为空")]
public string FileExtension { get; set; }
/// <summary>
/// 二进制数据
/// </summary>
[Required(ErrorMessage = "二进制数据不能为空")]
public long Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
[Required(ErrorMessage = "文件大小不能为空")]
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
[Required(ErrorMessage = "文件名称不能为空")]
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
[Required(ErrorMessage = "文件名称不能为空")]
public string FileName { get; set; }
}

13
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; }
}

2
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application.Contracts/Lion.AbpPro.FileManagement.Application.Contracts.csproj

@ -7,8 +7,10 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" />
<PackageReference Include="Volo.Abp.Ddd.Application.Contracts" />
<PackageReference Include="Volo.Abp.Authorization" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain.Shared\Lion.AbpPro.FileManagement.Domain.Shared.csproj" />
</ItemGroup>

5
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)

5
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<Lion.AbpPro.FileManagement.Files.File, PagingFileOutput>();
CreateMap<Files.FileObjectDto, PageFileObjectOutput>();
CreateMap<Files.FileObjectDto, GetFileObjectOutput>();
}
}

27
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<FileManagementApplicationModule>();
ConfigureBlobStoringAliyun(context);
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<FileManagementApplicationModule>(true); });
}
private void ConfigureBlobStoringAliyun(ServiceConfigurationContext context)
{
var configuration = context.Services.GetConfiguration();
Configure<AbpBlobStoringOptions>(options =>
{
options.Containers.ConfigureDefault(container =>
{
container.UseAliyun(aliyun =>
{
aliyun.AccessKeyId =
configuration.GetValue<string>("AliYun:OSS:AccessKeyId");
aliyun.AccessKeySecret =
configuration.GetValue<string>("AliYun:OSS:AccessKeySecret");
aliyun.Endpoint = configuration.GetValue<string>("AliYun:OSS:Endpoint");
aliyun.RegionId = configuration.GetValue<string>("AliYun:OSS:RegionId");
aliyun.ContainerName =
configuration.GetValue<string>("AliYun:OSS:ContainerName");
});
});
});
}
}

127
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;
/// <summary>
/// 文件
/// </summary>
[Authorize]
public class FileAppService : ApplicationService, IFileAppService
{
private readonly FileObjectManager _fileObjectManager;
private readonly IFileProvider _fileProvider;
public FileAppService(FileObjectManager fileObjectManager, IFileProvider fileProvider)
{
private readonly IFileManager _fileManager;
private readonly IConfiguration _configuration;
_fileObjectManager = fileObjectManager;
_fileProvider = fileProvider;
}
public FileAppService(IFileManager fileManager, IConfiguration configuration)
/// <summary>
/// 分页查询文件
/// </summary>
public async Task<PagedResultDto<PageFileObjectOutput>> PageAsync(PageFileObjectInput input)
{
_fileManager = fileManager;
_configuration = configuration;
var result = new PagedResultDto<PageFileObjectOutput>();
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<FileObjectDto>, List<PageFileObjectOutput>>(list);
return result;
}
public virtual async Task<FileTokenOutput> GetFileTokenAsync()
public async Task<List<UploadOutput>> UploadAsync(List<IFormFile> files)
{
var result = new List<UploadOutput>();
foreach (var formFile in files)
{
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)
{
// 如何设置 sts https://help.aliyun.com/document_detail/100624.html
var regionId = _configuration.GetValue<string>("AliYun:OSS:RegionId");
var accessKeyId = _configuration.GetValue<string>("AliYun:OSS:AccessKeyId");
var accessKeySecret = _configuration.GetValue<string>("AliYun:OSS:AccessKeySecret");
var profile = DefaultProfile.GetProfile(regionId, accessKeyId, accessKeySecret);
var client = new DefaultAcsClient(profile);
var request = new AssumeRoleRequest()
Logger.LogError(e, "上传文件失败");
result.Add(new UploadOutput()
{
RoleArn = _configuration.GetValue<string>("AliYun:OSS:RoleArn"),
RoleSessionName = "Lion.AbpPro"
};
var response = client.GetAcsResponse(request);
Id = Guid.Empty,
Name = formFile.FileName,
Path = string.Empty,
Success = false
});
}
}
return result;
}
var result = new FileTokenOutput()
/// <summary>
/// 删除文件
/// </summary>
public Task DeleteAsync(DeleteFileObjectInput input)
{
AccessKeyId = response.Credentials.AccessKeyId,
AccessKeySecret = response.Credentials.AccessKeySecret,
Token = response.Credentials.SecurityToken,
Expiration = response.Credentials.Expiration,
Region = _configuration.GetValue<string>("AliYun:OSS:RegionId"),
Bucket = _configuration.GetValue<string>("AliYun:OSS:ContainerName"),
};
return await Task.FromResult(result);
return _fileObjectManager.DeleteAsync(input.Id);
}
[Authorize(FileManagementPermissions.FileManagement.Upload)]
public virtual async Task CreateAsync(CreateFileInput input)
public async Task<GetFileObjectOutput> GetAsync(GetFileObjectInput input)
{
await _fileManager.CreateAsync(input.FileName, input.FilePath);
var file = await _fileObjectManager.GetAsync(input.Id);
return ObjectMapper.Map<FileObjectDto, GetFileObjectOutput>(file);
}
public virtual async Task<PagedResultDto<PagingFileOutput>> PagingAsync(PagingFileInput input)
public async Task<FileContentResult> DownloadAsync(DownloadFileObjectInput input)
{
var result = new PagedResultDto<PagingFileOutput>();
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<File>, List<PagingFileOutput>>(entities);
return result;
var file = await _fileObjectManager.GetAsync(input.Id);
return new Microsoft.AspNetCore.Mvc.FileContentResult(file.Bytes, file.ContentType);
}
}

6
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;

2
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Application/Lion.AbpPro.FileManagement.Application.csproj

@ -7,9 +7,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="2.2.0" />
<PackageReference Include="Volo.Abp.AutoMapper" />
<PackageReference Include="Volo.Abp.Ddd.Application" />
<PackageReference Include="Volo.Abp.BlobStoring.Aliyun" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Application.Contracts\Lion.AbpPro.FileManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain\Lion.AbpPro.FileManagement.Domain.csproj" />
</ItemGroup>

51
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain.Shared/Files/FileObjectDto.cs

@ -0,0 +1,51 @@
namespace Lion.AbpPro.FileManagement.Files;
/// <summary>
/// 文件
/// </summary>
public class FileObjectDto
{
/// <summary>
/// 主键Id
/// </summary>
public Guid Id { get; set; }
/// <summary>
/// 创建时间
/// </summary>
public DateTime CreationTime { get; set; }
/// <summary>
/// 文件Provider
/// </summary>
public string ProviderKey { get; set; }
/// <summary>
/// 文件扩展名
/// </summary>
public string FileExtension { get; set; }
/// <summary>
/// 二进制数据
/// </summary>
public byte[] Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
private const string CacheKeyFormat = "i:{0}";
public static string CalculateCacheKey(Guid id)
{
return string.Format(CacheKeyFormat, id);
}
}

26
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
{
/// <summary>
/// 二进制数据
/// </summary>
public byte[] Bytes { get; set; }
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string ContentType { get; set; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; set; }
public Dictionary<string, object> ExtraProperties { get; set; }
}

17
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<string, object>();
}
public Dictionary<string, object> ExtraProperties { get; set; }
}

2
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;
}

13
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<FileObject, FileObjectDto>();
}
}
}

7
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<AbpAutoMapperOptions>(options => { options.AddMaps<FileManagementDomainModule>(); });
}
}

22
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/Aggregates/File.cs

@ -1,22 +0,0 @@
namespace Lion.AbpPro.FileManagement.Files;
public class File: FullAuditedAggregateRoot<Guid>, 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;
}
}

33
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/FileManager.cs

@ -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<List<File>> PagingAsync(
string filter = null,
int maxResultCount = 10,
int skipCount = 0)
{
return await _fileRepository.GetPagingListAsync(filter, maxResultCount, skipCount);
}
public virtual async Task<long> CountAsync(string filter = null)
{
return await _fileRepository.GetPagingCountAsync(filter);
}
}

137
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;
/// <summary>
/// 文件
/// </summary>
public class FileObject : FullAuditedAggregateRoot<Guid>, 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; }
/// <summary>
/// 文件名称
/// </summary>
public string FileName { get; private set; }
/// <summary>
/// 文件名称
/// </summary>
public string ContentType { get; private set; }
/// <summary>
/// 文件大小
/// </summary>
public long FileSize { get; private set; }
/// <summary>
/// 文件扩展名
/// </summary>
public string FileExtension { get; private set; }
/// <summary>
/// 二进制数据
/// </summary>
public byte[] Bytes { get; private set; }
/// <summary>
/// 文件Provider
/// </summary>
public string ProviderKey { get; private set; }
/// <summary>
/// 设置文件Provider
/// </summary>
private void SetProviderKey(string providerKey)
{
Guard.NotNullOrWhiteSpace(providerKey, nameof(providerKey), 128, 0);
ProviderKey = providerKey;
}
/// <summary>
/// 设置文件扩展名
/// </summary>
private void SetFileExtension(string fileExtension)
{
Guard.NotNullOrWhiteSpace(fileExtension, nameof(fileExtension), 36, 0);
FileExtension = fileExtension;
}
/// <summary>
/// 设置二进制数据
/// </summary>
private void SetBytes(byte[] bytes)
{
Bytes = bytes;
}
/// <summary>
/// 设置文件大小
/// </summary>
private void SetFileSize(long fileSize)
{
FileSize = fileSize;
}
/// <summary>
/// 设置文件名称
/// </summary>
private void SetContentType(string contentType)
{
Guard.NotNullOrWhiteSpace(contentType, nameof(contentType), 128, 0);
ContentType = contentType;
}
/// <summary>
/// 设置文件名称
/// </summary>
private void SetFileName(string fileName)
{
Guard.NotNullOrWhiteSpace(fileName, nameof(fileName), 128, 0);
SetFileExtension(Path.GetExtension(fileName));
FileName = fileName;
}
/// <summary>
/// 更新文件
/// </summary>
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);
}
}

65
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<List<FileObjectDto>> 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<long> GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null)
{
return await _fileObjectRepository.GetCountAsync(fileName, startDateTime, endDateTime);
}
/// <summary>
/// 创建文件
/// </summary>
public async Task<FileObjectDto> 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<FileObject, FileObjectDto>(entity);
}
/// <summary>
/// 删除文件
/// </summary>
public async Task DeleteAsync(Guid id)
{
var entity = await _fileObjectRepository.FindAsync(id);
if (entity == null) throw new UserFriendlyException($"文件不存在");
await _fileObjectRepository.DeleteAsync(entity);
}
/// <summary>
/// 删除文件
/// </summary>
public async Task<FileObjectDto> GetAsync(Guid id)
{
var entity = await _fileObjectRepository.FindAsync(id);
if (entity == null) throw new UserFriendlyException($"文件不存在");
return _objectMapper.Map<FileObject, FileObjectDto>(entity);
}
}

15
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileManager.cs

@ -1,15 +0,0 @@
namespace Lion.AbpPro.FileManagement.Files;
public interface IFileManager
{
Task CreateAsync(string fileName, string filePath);
Task<List<File>> PagingAsync(
string filter = null,
int maxResultCount = 10,
int skipCount = 0);
Task<long> CountAsync(string filter = null);
IAbpLazyServiceProvider LazyServiceProvider { get; set; }
IServiceProvider ServiceProvider { get; set; }
}

8
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<FileObject, Guid>
{
Task<List<FileObjectDto>> GetListAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null, int maxResultCount = 10, int skipCount = 0);
Task<long> GetCountAsync(string fileName, DateTime? startDateTime = null, DateTime? endDateTime = null);
}

13
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Files/IFileRepository.cs

@ -1,13 +0,0 @@
namespace Lion.AbpPro.FileManagement.Files;
public interface IFileRepository: IRepository<File, Guid>
{
Task<List<File>> GetPagingListAsync(
string filter = null,
int maxResultCount = 10,
int skipCount = 0,
CancellationToken cancellationToken = default);
Task<long> GetPagingCountAsync(string filter = null,
CancellationToken cancellationToken = default);
}

1
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.Domain/Lion.AbpPro.FileManagement.Domain.csproj

@ -8,6 +8,7 @@
<ItemGroup>
<PackageReference Include="Volo.Abp.Ddd.Domain" />
<PackageReference Include="Volo.Abp.AutoMapper" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain.Shared\Lion.AbpPro.FileManagement.Domain.Shared.csproj" />
</ItemGroup>

30
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<UpdateResult> 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
};
}
}

6
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<UpdateResult> UploadAsync(UpdateDto input);
}

2
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/FileManagementDbContext.cs

@ -19,5 +19,5 @@ public class FileManagementDbContext : AbpDbContext<FileManagementDbContext>, IF
builder.ConfigureFileManagement();
}
public DbSet<Lion.AbpPro.FileManagement.Files.File> Files { get; }
public DbSet<FileObject> FileObjects { get; set; }
}

13
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<Lion.AbpPro.FileManagement.Files.File>(b =>
builder.Entity<FileObject>(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();
});
}

49
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;
/// <summary>
/// 文件 仓储Ef core 实现
/// </summary>
public class EfCoreFileObjectRepository :
EfCoreRepository<FileManagementDbContext, FileObject, Guid>,
IFileObjectRepository
{
public EfCoreFileObjectRepository(IDbContextProvider<FileManagementDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<List<FileObjectDto>> 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<long> 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();
}
}

31
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/EntityFrameworkCore/Files/EfCoreFileRepository.cs

@ -1,31 +0,0 @@
namespace Lion.AbpPro.FileManagement.EntityFrameworkCore.Files;
public class EfCoreFileRepository: EfCoreRepository<IFileManagementDbContext,Lion.AbpPro.FileManagement.Files.File, Guid>, IFileRepository
{
public EfCoreFileRepository(IDbContextProvider<IFileManagementDbContext> dbContextProvider) : base(dbContextProvider)
{
}
public async Task<List<Lion.AbpPro.FileManagement.Files.File>> 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<long> GetPagingCountAsync(string filter = null,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.WhereIf(!filter.IsNullOrWhiteSpace(),
e => (e.FileName.Contains(filter)))
.CountAsync(cancellationToken: cancellationToken);
}
}

6
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<Question> Questions { get; }
*/
DbSet<Lion.AbpPro.FileManagement.Files.File> Files { get; }
DbSet<FileObject> FileObjects { get; }
}

1
aspnet-core/modules/FileManagement/src/Lion.AbpPro.FileManagement.EntityFrameworkCore/Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj

@ -7,7 +7,6 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Volo.Abp.EntityFrameworkCore" />
<ProjectReference Include="..\Lion.AbpPro.FileManagement.Domain\Lion.AbpPro.FileManagement.Domain.csproj" />
</ItemGroup>

45
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<FileTokenOutput> GetFileTokenAsync()
[HttpPost("Page")]
[SwaggerOperation(summary: "分页查询文件", Tags = new[] { "Files" })]
public async Task<PagedResultDto<PageFileObjectOutput>> PageAsync(PageFileObjectInput input)
{
return await _fileAppService.PageAsync(input);
}
[HttpPost("Upload")]
[SwaggerOperation(summary: "上传文件", Tags = new[] { "Files" })]
public async Task<List<UploadOutput>> UploadAsync(List<IFormFile> 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<GetFileObjectOutput> GetAsync(GetFileObjectInput input)
{
return _fileAppService.CreateAsync(input);
return _fileAppService.GetAsync(input);
}
[HttpPost("page")]
[SwaggerOperation(summary: "分页查询", Tags = new[] { "Files" })]
public Task<PagedResultDto<PagingFileOutput>> PagingAsync(PagingFileInput input)
[HttpPost("Download")]
[SwaggerOperation(summary: "下载文件", Tags = new[] { "Files" })]
public Task<FileContentResult> DownloadAsync(DownloadFileObjectInput input)
{
return _fileAppService.PagingAsync(input);
return _fileAppService.DownloadAsync(input);
}
}

1
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;

10
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()
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();

2
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": {

5
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
{

1
aspnet-core/services/src/Lion.AbpPro.Application.Contracts/Lion.AbpPro.Application.Contracts.csproj

@ -7,6 +7,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.Application.Contracts\Lion.AbpPro.BasicManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.Application.Contracts\Lion.AbpPro.DataDictionaryManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.Application.Contracts\Lion.AbpPro.FileManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.Application.Contracts\Lion.AbpPro.NotificationManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Application.Contracts\Lion.AbpPro.LanguageManagement.Application.Contracts.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain.Shared\Lion.AbpPro.Domain.Shared.csproj" />

3
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

1
aspnet-core/services/src/Lion.AbpPro.Application/Lion.AbpPro.Application.csproj

@ -9,6 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.Application\Lion.AbpPro.BasicManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.Application\Lion.AbpPro.DataDictionaryManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.Application\Lion.AbpPro.FileManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.Application\Lion.AbpPro.NotificationManagement.Application.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Application\Lion.AbpPro.LanguageManagement.Application.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" />

4
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
{

1
aspnet-core/services/src/Lion.AbpPro.Domain.Shared/Lion.AbpPro.Domain.Shared.csproj

@ -17,6 +17,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.Domain.Shared\Lion.AbpPro.BasicManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.Domain.Shared\Lion.AbpPro.DataDictionaryManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.Domain.Shared\Lion.AbpPro.FileManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.Domain.Shared\Lion.AbpPro.NotificationManagement.Domain.Shared.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Domain.Shared\Lion.AbpPro.LanguageManagement.Domain.Shared.csproj" />
</ItemGroup>

5
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
{

1
aspnet-core/services/src/Lion.AbpPro.Domain/Lion.AbpPro.Domain.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.Domain\Lion.AbpPro.BasicManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.Domain\Lion.AbpPro.DataDictionaryManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.Domain\Lion.AbpPro.FileManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.Domain\Lion.AbpPro.NotificationManagement.Domain.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.Domain\Lion.AbpPro.LanguageManagement.Domain.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain.Shared\Lion.AbpPro.Domain.Shared.csproj" />

12
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<IdentityUser> Users { get; set; }
public DbSet<IdentityRole> Roles { get; set; }
@ -47,6 +49,7 @@ namespace Lion.AbpPro.EntityFrameworkCore
public DbSet<DataDictionary> DataDictionaries { get; set; }
public DbSet<Language> Languages { get; set; }
public DbSet<LanguageText> LanguageTexts { get; set; }
public DbSet<FileObject> FileObjects { get; set; }
public AbpProDbContext(DbContextOptions<AbpProDbContext> options)
: base(options)
@ -80,7 +83,12 @@ namespace Lion.AbpPro.EntityFrameworkCore
// 多语言
builder.ConfigureLanguageManagement();
// 文件模块
builder.ConfigureFileManagement();
}
}
}

4
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
{

1
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Lion.AbpPro.EntityFrameworkCore.csproj

@ -9,6 +9,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.EntityFrameworkCore\Lion.AbpPro.BasicManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.EntityFrameworkCore\Lion.AbpPro.DataDictionaryManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.EntityFrameworkCore\Lion.AbpPro.FileManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.EntityFrameworkCore\Lion.AbpPro.NotificationManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.EntityFrameworkCore\Lion.AbpPro.LanguageManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Domain\Lion.AbpPro.Domain.csproj" />

2179
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.Designer.cs

File diff suppressed because it is too large

61
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/20250215074519_1.0.2.cs

@ -0,0 +1,61 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lion.AbpPro.Migrations
{
/// <inheritdoc />
public partial class _102 : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AbpFileObjects",
columns: table => new
{
Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
TenantId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
FileName = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "文件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
ContentType = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "文件名称")
.Annotation("MySql:CharSet", "utf8mb4"),
FileSize = table.Column<long>(type: "bigint", nullable: false, comment: "文件大小"),
FileExtension = table.Column<string>(type: "varchar(36)", maxLength: 36, nullable: false, comment: "文件扩展名")
.Annotation("MySql:CharSet", "utf8mb4"),
Bytes = table.Column<byte[]>(type: "longblob", nullable: true, comment: "二进制数据"),
ProviderKey = table.Column<string>(type: "varchar(128)", maxLength: 128, nullable: false, comment: "文件Provider")
.Annotation("MySql:CharSet", "utf8mb4"),
ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
IsDeleted = table.Column<bool>(type: "tinyint(1)", nullable: false, defaultValue: false),
DeleterId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
DeletionTime = table.Column<DateTime>(type: "datetime(6)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AbpFileObjects", x => x.Id);
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_AbpFileObjects_FileName",
table: "AbpFileObjects",
column: "FileName");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AbpFileObjects");
}
}
}

90
aspnet-core/services/src/Lion.AbpPro.EntityFrameworkCore/Migrations/AbpProDbContextModelSnapshot.cs

@ -141,6 +141,96 @@ namespace Lion.AbpPro.Migrations
b.ToTable("AbpDataDictionaryDetails", (string)null);
});
modelBuilder.Entity("Lion.AbpPro.FileManagement.Files.FileObject", b =>
{
b.Property<Guid>("Id")
.HasColumnType("char(36)");
b.Property<byte[]>("Bytes")
.HasColumnType("longblob")
.HasComment("二进制数据");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.IsRequired()
.HasMaxLength(40)
.HasColumnType("varchar(40)")
.HasColumnName("ConcurrencyStamp");
b.Property<string>("ContentType")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("文件名称");
b.Property<DateTime>("CreationTime")
.HasColumnType("datetime(6)")
.HasColumnName("CreationTime");
b.Property<Guid?>("CreatorId")
.HasColumnType("char(36)")
.HasColumnName("CreatorId");
b.Property<Guid?>("DeleterId")
.HasColumnType("char(36)")
.HasColumnName("DeleterId");
b.Property<DateTime?>("DeletionTime")
.HasColumnType("datetime(6)")
.HasColumnName("DeletionTime");
b.Property<string>("ExtraProperties")
.IsRequired()
.HasColumnType("longtext")
.HasColumnName("ExtraProperties");
b.Property<string>("FileExtension")
.IsRequired()
.HasMaxLength(36)
.HasColumnType("varchar(36)")
.HasComment("文件扩展名");
b.Property<string>("FileName")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("文件名称");
b.Property<long>("FileSize")
.HasColumnType("bigint")
.HasComment("文件大小");
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("tinyint(1)")
.HasDefaultValue(false)
.HasColumnName("IsDeleted");
b.Property<DateTime?>("LastModificationTime")
.HasColumnType("datetime(6)")
.HasColumnName("LastModificationTime");
b.Property<Guid?>("LastModifierId")
.HasColumnType("char(36)")
.HasColumnName("LastModifierId");
b.Property<string>("ProviderKey")
.IsRequired()
.HasMaxLength(128)
.HasColumnType("varchar(128)")
.HasComment("文件Provider");
b.Property<Guid?>("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<Guid>("Id")

4
aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/AbpProHttpApiClientModule.cs

@ -1,4 +1,5 @@
using Lion.AbpPro.BasicManagement;
using Lion.AbpPro.FileManagement;
using Lion.AbpPro.LanguageManagement;
using Lion.AbpPro.NotificationManagement;
@ -9,7 +10,8 @@ namespace Lion.AbpPro
typeof(BasicManagementHttpApiClientModule),
typeof(DataDictionaryManagementHttpApiClientModule),
typeof(NotificationManagementHttpApiClientModule),
typeof(LanguageManagementHttpApiClientModule)
typeof(LanguageManagementHttpApiClientModule),
typeof(FileManagementHttpApiClientModule)
)]
public class AbpProHttpApiClientModule : AbpModule
{

1
aspnet-core/services/src/Lion.AbpPro.HttpApi.Client/Lion.AbpPro.HttpApi.Client.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.HttpApi.Client\Lion.AbpPro.BasicManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.HttpApi.Client\Lion.AbpPro.DataDictionaryManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.HttpApi.Client\Lion.AbpPro.FileManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.HttpApi.Client\Lion.AbpPro.NotificationManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.HttpApi.Client\Lion.AbpPro.LanguageManagement.HttpApi.Client.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Application.Contracts\Lion.AbpPro.Application.Contracts.csproj" />

4
aspnet-core/services/src/Lion.AbpPro.HttpApi/AbpProHttpApiModule.cs

@ -1,4 +1,5 @@
using Lion.AbpPro.BasicManagement;
using Lion.AbpPro.FileManagement;
using Lion.AbpPro.LanguageManagement;
namespace Lion.AbpPro
@ -8,7 +9,8 @@ namespace Lion.AbpPro
typeof(BasicManagementHttpApiModule),
typeof(DataDictionaryManagementHttpApiModule),
typeof(NotificationManagementHttpApiModule),
typeof(LanguageManagementHttpApiModule)
typeof(LanguageManagementHttpApiModule),
typeof(FileManagementHttpApiModule)
)]
public class AbpProHttpApiModule : AbpModule
{

1
aspnet-core/services/src/Lion.AbpPro.HttpApi/Lion.AbpPro.HttpApi.csproj

@ -10,6 +10,7 @@
<ItemGroup>
<ProjectReference Include="..\..\..\modules\BasicManagement\src\Lion.AbpPro.BasicManagement.HttpApi\Lion.AbpPro.BasicManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\DataDictionaryManagement\src\Lion.AbpPro.DataDictionaryManagement.HttpApi\Lion.AbpPro.DataDictionaryManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\FileManagement\src\Lion.AbpPro.FileManagement.HttpApi\Lion.AbpPro.FileManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\NotificationManagement\src\Lion.AbpPro.NotificationManagement.HttpApi\Lion.AbpPro.NotificationManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\modules\LanguageManagement\src\Lion.AbpPro.LanguageManagement.HttpApi\Lion.AbpPro.LanguageManagement.HttpApi.csproj" />
<ProjectReference Include="..\Lion.AbpPro.Application.Contracts\Lion.AbpPro.Application.Contracts.csproj" />

12
templates/pro-nuget/service/host/MyCompanyName.MyProjectName.HttpApi.Host/MyProjectNameHttpApiHostModule.cs

@ -58,7 +58,17 @@ namespace MyCompanyName.MyProjectName
app.UseAbpSerilogEnrichers();
app.UseUnitOfWork();
app.UseConfiguredEndpoints(endpoints => { endpoints.MapHealthChecks("/health"); });
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapHealthChecks("/health");
// endpoints.MapHangfireDashboard("/hangfire", new DashboardOptions()
// {
// Authorization = new[] { new CustomHangfireAuthorizeFilter() },
// IgnoreAntiforgeryToken = true
// });
});
if (configuration.GetValue("Consul:Enabled", false))

Loading…
Cancel
Save