Browse Source

Created initial Volo.Abp.BlobStoring package

pull/4105/head
Halil İbrahim Kalkan 6 years ago
parent
commit
b151c0f50d
  1. 7
      framework/Volo.Abp.sln
  2. 3
      framework/src/Volo.Abp.BlobStoring/FodyWeavers.xml
  3. 30
      framework/src/Volo.Abp.BlobStoring/FodyWeavers.xsd
  4. 21
      framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj
  5. 9
      framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/AbpBlobStoringModule.cs
  6. 87
      framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobManager.cs

7
framework/Volo.Abp.sln

@ -291,6 +291,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.AspNetCore.SignalR
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests", "test\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests\Volo.Abp.AspNetCore.Mvc.UI.Theme.Shared.Tests.csproj", "{79323211-E658-493E-9863-035AA4C3F913}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.BlobStoring", "src\Volo.Abp.BlobStoring\Volo.Abp.BlobStoring.csproj", "{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -865,6 +867,10 @@ Global
{79323211-E658-493E-9863-035AA4C3F913}.Debug|Any CPU.Build.0 = Debug|Any CPU
{79323211-E658-493E-9863-035AA4C3F913}.Release|Any CPU.ActiveCfg = Release|Any CPU
{79323211-E658-493E-9863-035AA4C3F913}.Release|Any CPU.Build.0 = Release|Any CPU
{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -1012,6 +1018,7 @@ Global
{B64FCE08-E9D2-4984-BF12-FE199F257416} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
{8B758716-DCC9-4223-8421-5588D1597487} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{79323211-E658-493E-9863-035AA4C3F913} = {447C8A77-E5F0-4538-8687-7383196D04EA}
{A0CFBDD6-A3CB-438C-83F1-5025F12E2D42} = {5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {BB97ECF4-9A84-433F-A80B-2A3285BDD1D5}

3
framework/src/Volo.Abp.BlobStoring/FodyWeavers.xml

@ -0,0 +1,3 @@
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
<ConfigureAwait ContinueOnCapturedContext="false" />
</Weavers>

30
framework/src/Volo.Abp.BlobStoring/FodyWeavers.xsd

@ -0,0 +1,30 @@
<?xml version="1.0" encoding="utf-8"?>
<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. -->
<xs:element name="Weavers">
<xs:complexType>
<xs:all>
<xs:element name="ConfigureAwait" minOccurs="0" maxOccurs="1">
<xs:complexType>
<xs:attribute name="ContinueOnCapturedContext" type="xs:boolean" />
</xs:complexType>
</xs:element>
</xs:all>
<xs:attribute name="VerifyAssembly" type="xs:boolean">
<xs:annotation>
<xs:documentation>'true' to run assembly verification (PEVerify) on the target assembly after all weavers have been executed.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="VerifyIgnoreCodes" type="xs:string">
<xs:annotation>
<xs:documentation>A comma-separated list of error codes that can be safely ignored in assembly verification.</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:attribute name="GenerateXsd" type="xs:boolean">
<xs:annotation>
<xs:documentation>'false' to turn off automatic generation of the XML Schema file.</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:schema>

21
framework/src/Volo.Abp.BlobStoring/Volo.Abp.BlobStoring.csproj

@ -0,0 +1,21 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\..\configureawait.props" />
<Import Project="..\..\..\common.props" />
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<AssemblyName>Volo.Abp.BlobStoring</AssemblyName>
<PackageId>Volo.Abp.BlobStoring</PackageId>
<AssetTargetFallback>$(AssetTargetFallback);portable-net45+win8+wp8+wpa81;</AssetTargetFallback>
<GenerateAssemblyConfigurationAttribute>false</GenerateAssemblyConfigurationAttribute>
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
<RootNamespace />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\Volo.Abp.Core\Volo.Abp.Core.csproj" />
</ItemGroup>
</Project>

9
framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/AbpBlobStoringModule.cs

@ -0,0 +1,9 @@
using Volo.Abp.Modularity;
namespace Volo.Abp.BlobStoring
{
public class AbpBlobStoringModule : AbpModule
{
}
}

87
framework/src/Volo.Abp.BlobStoring/Volo/Abp/BlobStoring/IBlobManager.cs

@ -0,0 +1,87 @@
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Volo.Abp.BlobStoring
{
public interface IBlobContainer
{
/// <summary>
/// Saves a blob <see cref="Stream"/> to the container.
/// </summary>
/// <param name="name">The name of the blob</param>
/// <param name="stream">A stream for the blob</param>
/// <param name="overrideExisting">
/// Set <code>true</code> to override if there is already a blob in the container with the given name.
/// If set to <code>false</code> (default), throws exception if there is already a blob in the container with the given name.
/// </param>
/// <param name="cancellationToken">Cancellation token</param>
Task SaveAsync(
string name,
Stream stream,
bool overrideExisting = false,
CancellationToken cancellationToken = default
);
/// <summary>
/// Deletes a blob from the container.
/// </summary>
/// <param name="name">The name of the blob</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>
/// Returns true if actually deleted the blob.
/// Returns false if the blob with the given <paramref name="name"/> was not exists.
/// </returns>
Task<bool> DeleteAsync(
string name,
CancellationToken cancellationToken = default
);
/// <summary>
/// Checks if a blob does exists in the container.
/// </summary>
/// <param name="name">The name of the blob</param>
/// <param name="cancellationToken">Cancellation token</param>
Task<bool> ExistsAsync(
string name,
CancellationToken cancellationToken = default
);
/// <summary>
/// Gets a blob from the container.
/// It actually gets a <see cref="Stream"/> to read the blob data.
/// It throws exception if there is no blob with the given <paramref name="name"/>.
/// Use <see cref="GetOrNullAsync"/> if you want to get <code>null</code> if there is no blob with the given <paramref name="name"/>.
/// </summary>
/// <param name="name">The name of the blob</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>
/// A <see cref="Stream"/> to read the blob data.
/// </returns>
Task<Stream> GetAsync(
string name,
CancellationToken cancellationToken = default
);
/// <summary>
/// Gets a blob from the container, or returns null if there is no blob with the given <paramref name="name"/>.
/// It actually gets a <see cref="Stream"/> to read the blob data.
/// </summary>
/// <param name="name">The name of the blob</param>
/// <param name="cancellationToken">Cancellation token</param>
/// <returns>
/// A <see cref="Stream"/> to read the blob data.
/// </returns>
Task<Stream> GetOrNullAsync(
string name,
CancellationToken cancellationToken = default
);
//TODO: Create shortcut extension methods: GetAsArraryAsync, GetAsStringAsync(encoding) (and null versions)
}
public interface IBlobContainerManager
{
//Get (or create), Delete (if does exists)
}
}
Loading…
Cancel
Save