|
|
@ -4,13 +4,16 @@ using JetBrains.Annotations;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Volo.Abp.BlobStoring
|
|
|
|
namespace Volo.Abp.BlobStoring
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public class BlobContainerConfigurationDictionary : Dictionary<string, BlobContainerConfiguration>
|
|
|
|
public class BlobContainerConfigurationDictionary
|
|
|
|
{
|
|
|
|
{
|
|
|
|
public BlobContainerConfiguration Default { get; }
|
|
|
|
public BlobContainerConfiguration Default { get; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private readonly Dictionary<string, BlobContainerConfiguration> _containers;
|
|
|
|
|
|
|
|
|
|
|
|
public BlobContainerConfigurationDictionary()
|
|
|
|
public BlobContainerConfigurationDictionary()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Default = new BlobContainerConfiguration();
|
|
|
|
Default = new BlobContainerConfiguration();
|
|
|
|
|
|
|
|
_containers = new Dictionary<string, BlobContainerConfiguration>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public BlobContainerConfigurationDictionary Configure<TContainer>(
|
|
|
|
public BlobContainerConfigurationDictionary Configure<TContainer>(
|
|
|
@ -29,7 +32,7 @@ namespace Volo.Abp.BlobStoring
|
|
|
|
Check.NotNullOrWhiteSpace(name, nameof(name));
|
|
|
|
Check.NotNullOrWhiteSpace(name, nameof(name));
|
|
|
|
Check.NotNull(configureAction, nameof(configureAction));
|
|
|
|
Check.NotNull(configureAction, nameof(configureAction));
|
|
|
|
|
|
|
|
|
|
|
|
configureAction(this.GetOrAdd(name, () => new BlobContainerConfiguration()));
|
|
|
|
configureAction(_containers.GetOrAdd(name, () => new BlobContainerConfiguration(Default)));
|
|
|
|
|
|
|
|
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -39,5 +42,23 @@ namespace Volo.Abp.BlobStoring
|
|
|
|
configureAction(Default);
|
|
|
|
configureAction(Default);
|
|
|
|
return this;
|
|
|
|
return this;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NotNull]
|
|
|
|
|
|
|
|
public BlobContainerConfiguration GetConfiguration<TContainer>([NotNull] string name)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Check.NotNullOrWhiteSpace(name, nameof(name));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return _containers.GetOrDefault(name) ??
|
|
|
|
|
|
|
|
Default;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[NotNull]
|
|
|
|
|
|
|
|
public BlobContainerConfiguration GetConfiguration([NotNull] string name)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
Check.NotNullOrWhiteSpace(name, nameof(name));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return _containers.GetOrDefault(name) ??
|
|
|
|
|
|
|
|
Default;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|