Open Closed

How to set prefixes for BlobContainers and Blobs tables for Database BLOB provider #1047


User avatar
0
raif created

Check the docs before asking a question: https://docs.abp.io/en/commercial/latest/ Check the samples, to see the basic tasks: https://docs.abp.io/en/commercial/latest/samples/index The exact solution to your question may have been answered before, please use the search on the homepage.

  • ABP Framework version: v4.2.2
  • UI type: MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • 2021-03-15 13:19:27.882 +03:00 [ERR] Invalid object name 'AbpBlobContainers'. Microsoft.Data.SqlClient.SqlException (0x80131904): Invalid object name 'AbpBlobContainers'. at Microsoft.Data.SqlClient.SqlCommand.<>c.<ExecuteDbDataReaderAsync>b__169_0(Task1 result) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state) --- End of stack trace from previous location --- at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread) --- End of stack trace from previous location --- at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Storage.RelationalCommand.ExecuteReaderAsync(RelationalCommandParameterObject parameterObject, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.InitializeReaderAsync(DbContext _, Boolean result, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerExecutionStrategy.ExecuteAsync[TState,TResult](TState state, Func4 operation, Func4 verifySucceeded, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.Internal.SplitQueryingEnumerable1.AsyncEnumerator.MoveNextAsync() at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Microsoft.EntityFrameworkCore.Query.ShapedQueryCompilingExpressionVisitor.SingleOrDefaultAsync[TSource](IAsyncEnumerable1 asyncEnumerable, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.Database.EntityFrameworkCore.EfCoreDatabaseBlobContainerRepository.FindAsync(String name, CancellationToken cancellationToken) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapterWithReturnValue1.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync[TResult](IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Volo.Abp.BlobStoring.Database.DatabaseBlobProvider.GetOrCreateContainerAsync(String name, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.Database.DatabaseBlobProvider.SaveAsync(BlobProviderSaveArgs args) at Volo.Abp.BlobStoring.BlobContainer.SaveAsync(String name, Stream stream, Boolean overrideExisting, CancellationToken cancellationToken) at Volo.Abp.BlobStoring.BlobContainerExtensions.SaveAsync(IBlobContainer container, String name, Byte[] bytes, Boolean overrideExisting, CancellationToken cancellationToken) at Siemens.Odms.FileAppService.SaveBlobAsync(SaveBlobInput saveBlobInput) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Auditing.AuditingInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Validation.ValidationInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func3 proceed) at Castle.DynamicProxy.AsyncInterceptorBase.ProceedAsynchronous(IInvocation invocation, IInvocationProceedInfo proceedInfo) at Volo.Abp.Castle.DynamicProxy.CastleAbpMethodInvocationAdapter.ProceedAsync() at Volo.Abp.Uow.UnitOfWorkInterceptor.InterceptAsync(IAbpMethodInvocation invocation) at Volo.Abp.Castle.DynamicProxy.CastleAsyncAbpInterceptorAdapter1.InterceptAsync(IInvocation invocation, IInvocationProceedInfo proceedInfo, Func`3 proceed) at Siemens.Odms.FileController.SaveBlobAsync(SaveBlobInput saveBlobInput) at lambda_method3887(Closure , Object ) at Microsoft.AspNetCore.Mvc.Infrastructure.ActionMethodExecutor.AwaitableResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments) at Microsoft.AspNetCore.Mvc.Infrastructure.ControllerActionInvoker.
  • Steps to reproduce the issue:

Configure blobstoring model creation with table prefix

builder.ConfigureBlobStoring(optionsAction: options => { options.TablePrefix = "Any prefix apart from Abp"; options.Schema = dbSchema; });

Maybe i'm blind as bat but not able to locate Volo.Abp.BlobStoring.Database.EntityFrameworkCore ? or anything related with Volo.Abp.BlobStoring.Database blob provider ?


4 Answer(s)
  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    You need to set BlobStoringDatabaseDbProperties.DbTablePrefix agagin before app start.

    The MyProjectNameMigrationsDbContext only used for migarion.

  • User Avatar
    0
    raif created

    hi thx for response is there any specific reason about set that definition at startup ? How about set it at modules ?

    Do you have small example regarding usage of multitenancy with database provider in your hand ?

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    is there any specific reason about set that definition at startup ? How about set it at modules ?

    This is a static property, you have to make sure to configure it before using dbcontext, so I changed it in the startup.

    usage of multitenancy with database provider

    There is no example for now, You can check the document. https://docs.abp.io/en/abp/latest/Entity-Framework-Core

  • User Avatar
    0
    raif created

    thx

Made with ❤️ on ABP v9.1.0-preview. Updated on November 01, 2024, 05:35