ABP Framework version: 4.4.0
UI type: Angular
DB provider: EF Core
Tiered (MVC) or Identity Server Separated (Angular): yes
**Exception message and stack trace olo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnApplicationInitializationModuleLifecycleContributor phase of the module Volo.Abp.Quartz.AbpQuartzModule, Volo.Abp.Quartz, Version=4.4.0.0, Culture=neutral, PublicKeyToken=null: An exception was thrown while activating λ:Quartz.IScheduler.. See the inner exception for details. ---- Autofac.Core.DependencyResolutionException : An exception was thrown while activating λ:Quartz.IScheduler. -------- Quartz.SchedulerException : Scheduler with name 'QuartzScheduler' already exists.
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest1.ctor() BackgroundProcessesTestBase
1.ctor()
SchedulerCreationFailingTestExample.ctor()
----- Inner Stack Trace -----
ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action1 next) <>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) ResolvePipeline.Invoke(ResolveRequestContext ctxt) <42 more frames...> AsyncHelper.RunSync[TResult](Func
1 func)
<>c.<ConfigureServices>b__1_1(IServiceProvider serviceProvider)
<>c__DisplayClass3_0.<Register>b__0(IComponentContext context, IEnumerable1 parameters) DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable
1 parameters)
DelegateActivator.<ConfigurePipeline>b__2_0(ResolveRequestContext ctxt, Action1 next) DelegateMiddleware.Execute(ResolveRequestContext context, Action
1 next)
<>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt)
DisposalTrackingMiddleware.Execute(ResolveRequestContext context, Action1 next) <>c__DisplayClass14_0.<BuildPipeline>b__1(ResolveRequestContext ctxt) ActivatorErrorHandlingMiddleware.Execute(ResolveRequestContext context, Action
1 next)
**Steps to reproduce the issue:
I'm tring to unit test my Quarz background workers. Whenever I run multiple tests where I initialize a backround worker the tests fail because the IScheduler is already created with another test. My tests are integration tests since I need some registered services in my workers. I dosen't make a difference if I use a new scheduler for the actual scheduling in my tests like this:
IScheduler scheduler = await GetNewScheduler();
// Act
ISchedulerListener listener = Substitute.For<ISchedulerListener>();
scheduler.ListenerManager.AddSchedulerListener(listener);
await worker.ScheduleJob.Invoke(scheduler);
My test module depend on a module that depends on AbpBackgroundWorkersQuartzModule and through that the Quartz gets initialized. It seems to me that AbpIntegratedTest initialization doesn't take into account that the Quartz cannot be initialized multiple times. I realize that this is possibly a Quarz problem but is there a some way to change the Quarz initialization so that IScheduler implementation will be initialized only once.
OK, I have done that. How can I share this with you?
ArgumentNullException: Value cannot be null. Arg_ParamName_Name (ConnectionString)
I created a new console application with the cli generator. After that I created a module that depends on the settings module. Apparently this brings a dependency to SettingManagementDbContext. My intend was to create a unit test module to test the module and I mimiced the Domain.test -project initilaziation from another application. However this time the initilization wants to use the real database instead of the in memory -database for SettingManagementDbContext.
What should I do in the test base initialization to make a generic module to use in memory-database?
Not publicly unless I do a new similar but generic project.
I Have two questions:
public class TenantCalculationTimeSettingProvider : SettingDefinitionProvider
{
public override void Define(ISettingDefinitionContext context)
{
context.Add(
new SettingDefinition("CalculationTimeCronConf"
, "0 */1 * ? * *"
, new LocalizableString(typeof(TenantCalculationTimeSettingProvider), "configuration for time scheduled calculation")
,new LocalizableString(typeof(TenantCalculationTimeSettingProvider), "configuration for time scheduled calculation")
));
}
}
I cannot get the Define-method to fire no matter what I try. I have added the dependency to AbpSettingsModule and tried to register the provider manually
public override void ConfigureServices(ServiceConfigurationContext context)
{
Configure<AbpSettingOptions>(options =>
{
options.DefinitionProviders.Add<TenantCalculationTimeSettingProvider>();
});
}
If I add the same provider in my main web application it works. I'm I missing some dependency in my new application for the Define to work?
2 If I define the setting this way, is there an Angular component (In commersial package perhaps) that enables viewing and editing this setting?
Hello, is there a reason why no foreign key constraints are create from the audit fields CreatorId and LastModifierId to the user? Is is preferred to keep that way or could we add such contraints? Our use case is to show the last updater user in UI.
Ok, thank you. I get the impression that you would not prefer DbContext inheritance in any case. What problems do you see in that approach?
Thank you for your answer! Can you please clarify what this means "To not have problem in your migration, don't include this mapping in the unified migration." If I create the "dublicate" entity into module A. I have to have entity configuration to map the entity into the same table. How would I then exclude the configuration from migration creation?
Hey, I'm desisingn an application module that depends on our core module entities. In the application module, I have entites that reference core module entities via Id reference. I'm trying create a solution where it would be easy and efficient to join data from core module entites to a query in the application module. The module is designed to be an integrated part of the system so dublicating data into that module is not the best solution. The entity extension system doesn't seem to be quite what I'm looking for either.
One way to achive this would be to use DbContext inheritance so the core module entites would be in use through the application module dbContext. However this is not possible at the moment because I ran into this problem: https://stackoverflow.com/questions/41829229/how-do-i-implement-dbcontext-inheritance-for-multiple-databases-in-ef7-net-co . The suggested solution would be to add the protected constructor with non generic options injected as parameter. This would have to be in the AbpDbContext however.
I'm wondering would be the suggested way to link dbContexts together or join data over multiple dbContexts?
Hi Albert, thank you for the answer. We tried it that way but the problem with that approach is that it's not easy to populate all the value object data to a grid showing parent entity's data. Going the other route and defining the value object's properties separaterly to the parent entity and then changing backend code to form a value object, also needs a lot of customization to the generated code. Either way having to change the code after generation ruins the maintainability of the entity (with suite). Thus we desided not to use Value Objects at this point and describe the data as separate properties inside the parent entity. Unfortunately this deficit undermines our domain model a bit :(