Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use sync API to download Blob #8204

Merged
merged 1 commit into from
Mar 26, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using JetBrains.Annotations;
using System;
using Volo.Abp.Auditing;
using Volo.Abp.Domain.Entities;
using Volo.Abp.MultiTenancy;

Expand All @@ -13,6 +14,7 @@ public class DatabaseBlob : AggregateRoot<Guid>, IMultiTenant

public virtual string Name { get; protected set; }

[DisableAuditing]
public virtual byte[] Content { get; protected set; }

public DatabaseBlob(Guid id, Guid containerId, [NotNull] string name, [NotNull] byte[] content, Guid? tenantId = null)
Expand All @@ -32,7 +34,7 @@ public virtual void SetContent(byte[] content)
protected virtual byte[] CheckContentLength(byte[] content)
{
Check.NotNull(content, nameof(content));

if (content.Length >= DatabaseBlobConsts.MaxContentLength)
{
throw new AbpException($"Blob content size cannot be more than {DatabaseBlobConsts.MaxContentLength} Bytes.");
Expand All @@ -41,4 +43,4 @@ protected virtual byte[] CheckContentLength(byte[] content)
return content;
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Microsoft.EntityFrameworkCore;
using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Domain.Repositories.EntityFrameworkCore;
Expand All @@ -20,10 +21,9 @@ public EfCoreDatabaseBlobRepository(IDbContextProvider<IBlobStoringDbContext> db
string name,
CancellationToken cancellationToken = default)
{
return await (await GetDbSetAsync())
.FirstOrDefaultAsync(
x => x.ContainerId == containerId && x.Name == name,
GetCancellationToken(cancellationToken)
return (await GetDbSetAsync())
.FirstOrDefault(
x => x.ContainerId == containerId && x.Name == name
);
}

Expand Down