@gterdem Should i create new topic for my question or is it ok keep at here ? Any feedback about "multi-tenant usage of background jobs' is welcome
Thx in advance
Hi @raif, can you solved this problem ? i have a problem like this.
Yes, with help of best practice documentation i'm fine. See : https://docs.abp.io/en/abp/latest/Best-Practices/Entity-Framework-Core-Integration#repository-implementation
Ok, first of all, lets be agree on when license check operation will perform. https://support.abp.io/QA/Questions/69/#answer-d8bebebb-b714-3c1e-7fcb-39f437bc8ba3
According to following anwser, license check should only perform if envrionment value set to the "Development" Then why i need to expose my developer AbpLicenseCode to end user ?
Ensure that your appsettings.json has "AbpLicenseCode" key with your license code.
Can you check the
appsettings.json
file?
Why should i add license code to get rid off error message ?
**Note **: My migration is working properly even if there is error message on the console screen
I would like create "custom" db migrator console app for my customers. Migrator should handle both commercial and non-commercial modules tables.
Error indicates that:
2021-05-12 16:56:31.322 +03:00 [INF] Started database migrations... 2021-05-12 16:56:31.337 +03:00 [INF] Migrating schema for host database... 2021-05-12 16:57:03.844 +03:00 [ERR] ABP-LIC-0020 - License code not found! Ensure that your appsettings.json has "AbpLicenseCode" key with your license code. 2021-05-12 16:57:03.844 +03:00 [ERR] ABP-LIC-0008 - License check failed for 'Volo.Abp.Identity.Pro.Domain-v4.3.0.0'.
.cs proj
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<EnvironmentName>Production</EnvironmentName>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Stage|AnyCPU'">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<EnvironmentName>Staging</EnvironmentName>
</PropertyGroup>
Set both ASPNETCORE_ENVIRONMENT and ENVIRONMENT to the Production / anything that different from 'Development'
I tried use launch via dotnet with "-e"
What am i missing ?
ABP Framework version: v4.3 UI type:MVC DB provider: EF Core Tiered (MVC) or Identity Server Separated (Angular): yes
Hello, I guess i can use same topic for the question. Unfortunately documentation doesn't mention about how to achieve multi-tenant usage
Is this background job aware of Tenant ?
By template default my HOST application capable to execute background jobs. I have a separate database for each of my tenants Tenant may want to execute background job which is need to update tenant's table
For this purpose i injected ICurrentTenant service to the Job and tenantId parameters to the job arguments
Is this correct approach
Second question Is there any possibility to get try count in the job code ?
public class BackgroundImportOperationUpdateJob : AsyncBackgroundJob<BackgroundImportOperationUpdateArgs>, ITransientDependency
{
private IModelManager ModelManager { get; }
private ICurrentTenant CurrentTenant { get; }
public BackgroundImportOperationUpdateJob(
IModelManager modelManager,
ICurrentTenant currentTenant)
{
ModelManager = modelManager;
CurrentTenant = currentTenant;
}
}
using (CurrentTenant.Change(args.TenantId))
{
// Perform operation with domain services in the selected tenant
}
Doh do i need to set this to able use Find and Get method ?
"If you don't pass any expression to the WithDetailsAsync method, then it includes all the details using the DefaultWithDetailsFunc option you provide."
https://docs.abp.io/en/abp/4.2/Entity-Framework-Core#defaultwithdetailsfunc
Hello, Thx for the reply. I'm sorry i didn't get it https://docs.abp.io/en/abp/4.2/Entity-Framework-Core#loading-related-entities
Why should i override WithDetailsAsync and WithDetails methods ?
I have problem with Find and Get Method not with WithDetailsAsync and
Wasn't your answer already implemented on base EfCoreRepository class? But somehow i need to pass relation info
Check the docs before asking a question: https://docs.abp.io/en/abp/4.2/Entity-Framework-Core#repository-get-find-methods
IBasicRepository **Get ** and Find doesn't load related entities when even we set include details to the true
Thx Alper. Somehow i thought that i override TenantAppService as it is. I forgot webhost and configuration injections..
https://docs.abp.io/en/abp/latest/Testing#example-testing-an-application-service
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:
Autofac.Core.DependencyResolutionException: 'An exception was thrown while activating Siemens.NMM.Saas.Host.NMMTenantAppService.'
-InnerException {"None of the constructors found with 'Volo.Abp.Autofac.AbpAutofacConstructorFinder' on type 'Siemens.NMM.Saas.Host.NMMTenantAppService' can be invoked with the available services and parameters:\r\nCannot resolve parameter 'Microsoft.AspNetCore.Hosting.IWebHostEnvironment hosting' of constructor 'Void .ctor(Volo.Saas.Editions.IEditionRepository, Volo.Saas.Tenants.ITenantRepository, Volo.Saas.Tenants.ITenantManager, Volo.Abp.Data.IDataSeeder, Microsoft.Extensions.Configuration.IConfiguration, Microsoft.AspNetCore.Hosting.IWebHostEnvironment)'."} System.Exception {Autofac.Core.DependencyResolutionException}
Steps to reproduce the issue: I just override TenantAppService which is coming from Saas Module. Changes are very simple, one overriding of existing method, one totally new method
Now i would like to add tests related with those 2 method therefore i created Service Tests which inherits from Application Test Base
GetRequiredService<INMMTenantAppService>(); not able to resolve service.
What am i missing ?