Browse Source
feat(oss-management): extract OSS stream processing to the basic modulepull/1050/head
committed by
GitHub
45 changed files with 754 additions and 590 deletions
@ -0,0 +1,14 @@ |
|||||
|
using System.Collections.Generic; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement; |
||||
|
|
||||
|
public static class AbpOssManagementOptionsExtensions |
||||
|
{ |
||||
|
public static void AddProcesser<TProcesserContributor>( |
||||
|
this AbpOssManagementOptions options, |
||||
|
TProcesserContributor contributor) |
||||
|
where TProcesserContributor : IOssObjectProcesserContributor |
||||
|
{ |
||||
|
options.Processers.InsertBefore((x) => x is NoneOssObjectProcesser, contributor); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,8 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement; |
||||
|
|
||||
|
public interface IOssObjectProcesserContributor |
||||
|
{ |
||||
|
Task ProcessAsync(OssObjectProcesserContext context); |
||||
|
} |
||||
@ -0,0 +1,13 @@ |
|||||
|
using System.Threading.Tasks; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement; |
||||
|
|
||||
|
public class NoneOssObjectProcesser : IOssObjectProcesserContributor |
||||
|
{ |
||||
|
public Task ProcessAsync(OssObjectProcesserContext context) |
||||
|
{ |
||||
|
context.SetContent(context.OssObject.Content); |
||||
|
|
||||
|
return Task.CompletedTask; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,68 @@ |
|||||
|
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using System; |
||||
|
using System.Threading.Tasks; |
||||
|
using Volo.Abp; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement; |
||||
|
public abstract class OssContainerBase : IOssContainer |
||||
|
{ |
||||
|
protected AbpOssManagementOptions Options { get; } |
||||
|
protected IServiceScopeFactory ServiceScopeFactory { get; } |
||||
|
|
||||
|
protected OssContainerBase( |
||||
|
IOptions<AbpOssManagementOptions> options, |
||||
|
IServiceScopeFactory serviceScopeFactory) |
||||
|
{ |
||||
|
Options = options.Value; |
||||
|
ServiceScopeFactory = serviceScopeFactory; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task<OssObject> GetObjectAsync(GetOssObjectRequest request) |
||||
|
{ |
||||
|
var ossObject = await GetOssObjectAsync(request); |
||||
|
|
||||
|
if (ShouldProcessObject(ossObject) && !request.Process.IsNullOrWhiteSpace()) |
||||
|
{ |
||||
|
using var serviceScope = ServiceScopeFactory.CreateScope(); |
||||
|
var context = new OssObjectProcesserContext(request.Process, ossObject, serviceScope.ServiceProvider); |
||||
|
foreach (var processer in Options.Processers) |
||||
|
{ |
||||
|
await processer.ProcessAsync(context); |
||||
|
|
||||
|
if (context.Handled) |
||||
|
{ |
||||
|
ossObject.SetContent(context.Content); |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
return ossObject; |
||||
|
} |
||||
|
|
||||
|
public async virtual Task DeleteAsync(string name) |
||||
|
{ |
||||
|
if (Options.CheckStaticBucket(name)) |
||||
|
{ |
||||
|
throw new BusinessException(code: OssManagementErrorCodes.ContainerDeleteWithStatic); |
||||
|
} |
||||
|
|
||||
|
await DeleteBucketAsync(name); |
||||
|
} |
||||
|
|
||||
|
public abstract Task BulkDeleteObjectsAsync(BulkDeleteObjectRequest request); |
||||
|
public abstract Task<OssContainer> CreateAsync(string name); |
||||
|
public abstract Task<OssObject> CreateObjectAsync(CreateOssObjectRequest request); |
||||
|
public abstract Task DeleteObjectAsync(GetOssObjectRequest request); |
||||
|
public abstract Task<bool> ExistsAsync(string name); |
||||
|
public abstract Task<OssContainer> GetAsync(string name); |
||||
|
public abstract Task<GetOssContainersResponse> GetListAsync(GetOssContainersRequest request); |
||||
|
public abstract Task<GetOssObjectsResponse> GetObjectsAsync(GetOssObjectsRequest request); |
||||
|
protected abstract Task DeleteBucketAsync(string name); |
||||
|
protected abstract Task<OssObject> GetOssObjectAsync(GetOssObjectRequest request); |
||||
|
protected virtual bool ShouldProcessObject(OssObject ossObject) |
||||
|
{ |
||||
|
return true; |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Linq; |
||||
|
|
||||
|
namespace System; |
||||
|
public static class ByteExtensions |
||||
|
{ |
||||
|
private readonly static string[] ImageTypes = new string[] |
||||
|
{ |
||||
|
"6677",// bmp
|
||||
|
"7173",// gif
|
||||
|
"13780",// png
|
||||
|
"255216"// jpg
|
||||
|
}; |
||||
|
|
||||
|
public static bool IsImage(this byte[] fileBytes) |
||||
|
{ |
||||
|
if (fileBytes.IsNullOrEmpty()) |
||||
|
{ |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
string fileclass = ""; |
||||
|
for (int i = 0; i < 2; i++) |
||||
|
{ |
||||
|
fileclass += fileBytes[i].ToString(); |
||||
|
} |
||||
|
|
||||
|
return ImageTypes.Any(type => type.Equals(fileclass)); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
using System.Linq; |
||||
|
|
||||
|
namespace System; |
||||
|
public static class StringArrayArgsExtensions |
||||
|
{ |
||||
|
public static string GetStringPrarm(this string[] args, string key) |
||||
|
{ |
||||
|
if (!args.Any()) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
return args |
||||
|
.Where(arg => arg.StartsWith(key)) |
||||
|
.Select(arg => arg.Substring(key.Length)) |
||||
|
.FirstOrDefault(); |
||||
|
} |
||||
|
|
||||
|
public static string GetInt32Prarm(this string[] args, string key) |
||||
|
{ |
||||
|
if (!args.Any()) |
||||
|
{ |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
return args |
||||
|
.Where(arg => arg.StartsWith(key)) |
||||
|
.Select(arg => arg.Substring(key.Length)) |
||||
|
.FirstOrDefault(arg => int.TryParse(arg, out _)); |
||||
|
} |
||||
|
} |
||||
@ -1,15 +0,0 @@ |
|||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem.ImageSharp; |
|
||||
|
|
||||
[DependsOn(typeof(AbpOssManagementFileSystemModule))] |
|
||||
public class AbpOssManagementFileSystemImageSharpModule : AbpModule |
|
||||
{ |
|
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
|
||||
{ |
|
||||
Configure<FileSystemOssOptions>(options => |
|
||||
{ |
|
||||
options.AddProcesser(new ImageSharpProcesserContributor()); |
|
||||
}); |
|
||||
} |
|
||||
} |
|
||||
@ -1,12 +0,0 @@ |
|||||
using LINGYUN.Abp.OssManagement.FileSystem.Imaging; |
|
||||
using Volo.Abp.Imaging; |
|
||||
using Volo.Abp.Modularity; |
|
||||
|
|
||||
namespace LIINGYUN.Abp.OssManagement.FileSystem.Imaging.ImageSharp; |
|
||||
|
|
||||
[DependsOn( |
|
||||
typeof(AbpImagingImageSharpModule), |
|
||||
typeof(AbpOssManagementFileSystemImagingModule))] |
|
||||
public class AbpOssManagementFileSystemImagingImageSharpModule : AbpModule |
|
||||
{ |
|
||||
} |
|
||||
@ -1,18 +0,0 @@ |
|||||
using JetBrains.Annotations; |
|
||||
using System.Collections.Generic; |
|
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem; |
|
||||
|
|
||||
public class FileSystemOssOptions |
|
||||
{ |
|
||||
[NotNull] |
|
||||
public List<IFileSystemOssObjectProcesserContributor> Processers { get; } |
|
||||
|
|
||||
public FileSystemOssOptions() |
|
||||
{ |
|
||||
Processers = new List<IFileSystemOssObjectProcesserContributor> |
|
||||
{ |
|
||||
new NoneFileSystemOssObjectProcesser() |
|
||||
}; |
|
||||
} |
|
||||
} |
|
||||
@ -1,14 +0,0 @@ |
|||||
using System.Collections.Generic; |
|
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem; |
|
||||
|
|
||||
public static class FileSystemOssOptionsExtensions |
|
||||
{ |
|
||||
public static void AddProcesser<TProcesserContributor>( |
|
||||
this FileSystemOssOptions options, |
|
||||
TProcesserContributor contributor) |
|
||||
where TProcesserContributor : IFileSystemOssObjectProcesserContributor |
|
||||
{ |
|
||||
options.Processers.InsertBefore((x) => x is NoneFileSystemOssObjectProcesser, contributor); |
|
||||
} |
|
||||
} |
|
||||
@ -1,8 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem; |
|
||||
|
|
||||
public interface IFileSystemOssObjectProcesserContributor |
|
||||
{ |
|
||||
Task ProcessAsync(FileSystemOssObjectContext context); |
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
using System.Threading.Tasks; |
|
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem; |
|
||||
|
|
||||
public class NoneFileSystemOssObjectProcesser : IFileSystemOssObjectProcesserContributor |
|
||||
{ |
|
||||
public Task ProcessAsync(FileSystemOssObjectContext context) |
|
||||
{ |
|
||||
context.SetContent(context.OssObject.Content); |
|
||||
|
|
||||
return Task.CompletedTask; |
|
||||
} |
|
||||
} |
|
||||
@ -1,24 +1,24 @@ |
|||||
<Project Sdk="Microsoft.NET.Sdk"> |
<Project Sdk="Microsoft.NET.Sdk"> |
||||
|
|
||||
<Import Project="..\..\..\..\configureawait.props" /> |
<Import Project="..\..\..\..\configureawait.props" /> |
||||
<Import Project="..\..\..\..\common.props" /> |
<Import Project="..\..\..\..\common.props" /> |
||||
|
|
||||
<PropertyGroup> |
<PropertyGroup> |
||||
<TargetFramework>net8.0</TargetFramework> |
<TargetFramework>net8.0</TargetFramework> |
||||
<AssemblyName>LINGYUN.Abp.OssManagement.FileSystem.ImageSharp</AssemblyName> |
<AssemblyName>LINGYUN.Abp.OssManagement.ImageSharp</AssemblyName> |
||||
<PackageId>LINGYUN.Abp.OssManagement.FileSystem.ImageSharp</PackageId> |
<PackageId>LINGYUN.Abp.OssManagement.ImageSharp</PackageId> |
||||
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute> |
||||
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute> |
||||
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute> |
||||
<RootNamespace /> |
<RootNamespace /> |
||||
</PropertyGroup> |
</PropertyGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<PackageReference Include="SixLabors.ImageSharp.Drawing" /> |
<PackageReference Include="SixLabors.ImageSharp.Drawing" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
<ItemGroup> |
<ItemGroup> |
||||
<ProjectReference Include="..\LINGYUN.Abp.OssManagement.FileSystem\LINGYUN.Abp.OssManagement.FileSystem.csproj" /> |
<ProjectReference Include="..\LINGYUN.Abp.OssManagement.Domain\LINGYUN.Abp.OssManagement.Domain.csproj" /> |
||||
</ItemGroup> |
</ItemGroup> |
||||
|
|
||||
</Project> |
</Project> |
||||
@ -0,0 +1,15 @@ |
|||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.ImageSharp; |
||||
|
|
||||
|
[DependsOn(typeof(AbpOssManagementDomainModule))] |
||||
|
public class AbpOssManagementImageSharpModule : AbpModule |
||||
|
{ |
||||
|
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
|
{ |
||||
|
Configure<AbpOssManagementOptions>(options => |
||||
|
{ |
||||
|
options.AddProcesser(new ImageSharpOssObjectProcesser()); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
40
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.ImageSharp/LINGYUN/Abp/OssManagement/ImageSharp/ImageSharpOssObjectProcesser.cs
40
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.ImageSharp/LINGYUN/Abp/OssManagement/FileSystem/ImageSharp/ImageSharpFileSystemOssObjectProcesser.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.ImageSharp/LINGYUN/Abp/OssManagement/ImageSharp/ImageSharpOssObjectProcesser.cs
@ -1,34 +1,28 @@ |
|||||
using SixLabors.Fonts; |
using SixLabors.ImageSharp; |
||||
using SixLabors.ImageSharp; |
|
||||
using SixLabors.ImageSharp.Advanced; |
|
||||
using SixLabors.ImageSharp.Drawing.Processing; |
|
||||
using SixLabors.ImageSharp.Formats; |
|
||||
using SixLabors.ImageSharp.Processing; |
using SixLabors.ImageSharp.Processing; |
||||
using System; |
using System; |
||||
using System.Collections.Generic; |
|
||||
using System.IO; |
using System.IO; |
||||
using System.Linq; |
|
||||
using System.Threading.Tasks; |
using System.Threading.Tasks; |
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem.ImageSharp; |
namespace LINGYUN.Abp.OssManagement.ImageSharp; |
||||
|
|
||||
public class ImageSharpProcesserContributor : IFileSystemOssObjectProcesserContributor |
public class ImageSharpOssObjectProcesser : IOssObjectProcesserContributor |
||||
{ |
{ |
||||
public async virtual Task ProcessAsync(FileSystemOssObjectContext context) |
public async virtual Task ProcessAsync(OssObjectProcesserContext context) |
||||
{ |
{ |
||||
var copyStream = context.OssObject.Content; |
var copyStream = context.OssObject.Content; |
||||
var bytes = await copyStream.GetAllBytesAsync(); |
var bytes = await copyStream.GetAllBytesAsync(); |
||||
|
|
||||
if (bytes.IsImage()) |
if (bytes.IsImage()) |
||||
{ |
{ |
||||
var args = context.Process.Split(','); |
var args = context.Process.Split(','); |
||||
if (DrawGraphics(bytes, args, out var content)) |
if (DrawGraphics(bytes, args, out var content)) |
||||
{ |
{ |
||||
context.SetContent(content); |
context.SetContent(content); |
||||
|
|
||||
// 释放原图形流数据
|
// 释放原图形流数据
|
||||
await copyStream.DisposeAsync(); |
await copyStream.DisposeAsync(); |
||||
} |
} |
||||
} |
} |
||||
} |
} |
||||
|
|
||||
@ -1,6 +1,6 @@ |
|||||
# LINGYUN.Abp.OssManagement.FileSystem.ImageSharp |
# LINGYUN.Abp.OssManagement.ImageSharp |
||||
|
|
||||
本地文件系统oss对象ImageSharp图形处理接口 |
oss对象ImageSharp图形处理接口 |
||||
|
|
||||
## 配置使用 |
## 配置使用 |
||||
|
|
||||
@ -0,0 +1,11 @@ |
|||||
|
using Volo.Abp.Imaging; |
||||
|
using Volo.Abp.Modularity; |
||||
|
|
||||
|
namespace LINGYUN.Abp.OssManagement.Imaging.ImageSharp; |
||||
|
|
||||
|
[DependsOn( |
||||
|
typeof(AbpImagingImageSharpModule), |
||||
|
typeof(AbpOssManagementImagingModule))] |
||||
|
public class AbpOssManagementImagingImageSharpModule : AbpModule |
||||
|
{ |
||||
|
} |
||||
@ -1,30 +1,30 @@ |
|||||
<?xml version="1.0" encoding="utf-8"?> |
<?xml version="1.0" encoding="utf-8"?> |
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"> |
||||
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
<!-- This file was generated by Fody. Manual changes to this file will be lost when your project is rebuilt. --> |
||||
<xs:element name="Weavers"> |
<xs:element name="Weavers"> |
||||
<xs:complexType> |
<xs:complexType> |
||||
<xs:all> |
<xs:all> |
||||
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1"> |
||||
<xs:complexType> |
<xs:complexType> |
||||
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" /> |
||||
</xs:complexType> |
</xs:complexType> |
||||
</xs:element> |
</xs:element> |
||||
</xs:all> |
</xs:all> |
||||
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
<xs:attribute name="VerifyAssembly" type="xs:boolean"> |
||||
<xs:annotation> |
<xs:annotation> |
||||
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation> |
||||
</xs:annotation> |
</xs:annotation> |
||||
</xs:attribute> |
</xs:attribute> |
||||
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
<xs:attribute name="VerifyIgnoreCodes" type="xs:string"> |
||||
<xs:annotation> |
<xs:annotation> |
||||
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation> |
||||
</xs:annotation> |
</xs:annotation> |
||||
</xs:attribute> |
</xs:attribute> |
||||
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
<xs:attribute name="GenerateXsd" type="xs:boolean"> |
||||
<xs:annotation> |
<xs:annotation> |
||||
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation> |
||||
</xs:annotation> |
</xs:annotation> |
||||
</xs:attribute> |
</xs:attribute> |
||||
</xs:complexType> |
</xs:complexType> |
||||
</xs:element> |
</xs:element> |
||||
</xs:schema> |
</xs:schema> |
||||
16
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.Imaging/LINGYUN/Abp/OssManagement/FileSystem/Imaging/AbpImagingProcesserContributor.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Imaging/LINGYUN/Abp/OssManagement/Imaging/AbpImagingProcesserContributor.cs
16
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.Imaging/LINGYUN/Abp/OssManagement/FileSystem/Imaging/AbpImagingProcesserContributor.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Imaging/LINGYUN/Abp/OssManagement/Imaging/AbpImagingProcesserContributor.cs
8
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.Imaging/LINGYUN/Abp/OssManagement/FileSystem/Imaging/AbpOssManagementFileSystemImagingModule.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Imaging/LINGYUN/Abp/OssManagement/Imaging/AbpOssManagementImagingModule.cs
8
aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.FileSystem.Imaging/LINGYUN/Abp/OssManagement/FileSystem/Imaging/AbpOssManagementFileSystemImagingModule.cs → aspnet-core/modules/oss-management/LINGYUN.Abp.OssManagement.Imaging/LINGYUN/Abp/OssManagement/Imaging/AbpOssManagementImagingModule.cs
@ -1,16 +1,16 @@ |
|||||
using Volo.Abp.Imaging; |
using Volo.Abp.Imaging; |
||||
using Volo.Abp.Modularity; |
using Volo.Abp.Modularity; |
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.FileSystem.Imaging; |
namespace LINGYUN.Abp.OssManagement.Imaging; |
||||
|
|
||||
[DependsOn( |
[DependsOn( |
||||
typeof(AbpImagingAbstractionsModule), |
typeof(AbpImagingAbstractionsModule), |
||||
typeof(AbpOssManagementFileSystemModule))] |
typeof(AbpOssManagementDomainModule))] |
||||
public class AbpOssManagementFileSystemImagingModule : AbpModule |
public class AbpOssManagementImagingModule : AbpModule |
||||
{ |
{ |
||||
public override void ConfigureServices(ServiceConfigurationContext context) |
public override void ConfigureServices(ServiceConfigurationContext context) |
||||
{ |
{ |
||||
Configure<FileSystemOssOptions>(options => |
Configure<AbpOssManagementOptions>(options => |
||||
{ |
{ |
||||
options.AddProcesser(new AbpImagingProcesserContributor()); |
options.AddProcesser(new AbpImagingProcesserContributor()); |
||||
}); |
}); |
||||
@ -1,30 +1,41 @@ |
|||||
using LINGYUN.Abp.BlobStoring.Tencent; |
using LINGYUN.Abp.BlobStoring.Tencent; |
||||
using Volo.Abp.MultiTenancy; |
using Microsoft.Extensions.DependencyInjection; |
||||
|
using Microsoft.Extensions.Options; |
||||
|
using Volo.Abp.MultiTenancy; |
||||
using Volo.Abp.Timing; |
using Volo.Abp.Timing; |
||||
|
|
||||
namespace LINGYUN.Abp.OssManagement.Tencent; |
namespace LINGYUN.Abp.OssManagement.Tencent; |
||||
|
|
||||
public class TencentOssContainerFactory : IOssContainerFactory |
public class TencentOssContainerFactory : IOssContainerFactory |
||||
{ |
{ |
||||
protected IClock Clock { get; } |
protected IClock Clock { get; } |
||||
protected ICurrentTenant CurrentTenant { get; } |
protected ICurrentTenant CurrentTenant { get; } |
||||
protected ICosClientFactory CosClientFactory { get; } |
protected ICosClientFactory CosClientFactory { get; } |
||||
|
|
||||
public TencentOssContainerFactory( |
protected IServiceScopeFactory ServiceScopeFactory { get; } |
||||
IClock clock, |
protected IOptions<AbpOssManagementOptions> Options { get; } |
||||
ICurrentTenant currentTenant, |
|
||||
ICosClientFactory cosClientFactory) |
public TencentOssContainerFactory( |
||||
{ |
IClock clock, |
||||
Clock = clock; |
ICurrentTenant currentTenant, |
||||
CurrentTenant = currentTenant; |
ICosClientFactory cosClientFactory, |
||||
CosClientFactory = cosClientFactory; |
IServiceScopeFactory serviceScopeFactory, |
||||
} |
IOptions<AbpOssManagementOptions> options) |
||||
|
{ |
||||
public IOssContainer Create() |
Clock = clock; |
||||
{ |
CurrentTenant = currentTenant; |
||||
return new TencentOssContainer( |
CosClientFactory = cosClientFactory; |
||||
Clock, |
Options = options; |
||||
CurrentTenant, |
ServiceScopeFactory = serviceScopeFactory; |
||||
CosClientFactory); |
} |
||||
} |
|
||||
} |
public IOssContainer Create() |
||||
|
{ |
||||
|
return new TencentOssContainer( |
||||
|
Clock, |
||||
|
CurrentTenant, |
||||
|
CosClientFactory, |
||||
|
ServiceScopeFactory, |
||||
|
Options); |
||||
|
} |
||||
|
} |
||||
|
|||||
Loading…
Reference in new issue