Hello,
In which layer of the project should I add this code block? My structure is as follows:
I tried TestBase, Application and Domain, but I got the same result.
MyTestBaseModule
[DependsOn(
typeof(AbpAutofacModule),
typeof(AbpTestBaseModule),
typeof(AbpAuthorizationModule),
typeof(MyDomainModule)
)]
public class MyTestBaseModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAlwaysAllowAuthorization();
}
public override void OnApplicationInitialization(ApplicationInitializationContext context)
{
SeedTestData(context);
}
private static void SeedTestData(ApplicationInitializationContext context)
{
AsyncHelper.RunSync(async () =>
{
using (var scope = context.ServiceProvider.CreateScope())
{
await scope.ServiceProvider
.GetRequiredService\<IDataSeeder>()
.SeedAsync();
}
});
}
}
**MyDomainTestModule**
[DependsOn(
typeof(MyEntityFrameworkCoreTestModule)
)]
public class MyDomainTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAlwaysDisableUnitOfWorkTransaction();
}
}
**MyApplicationTestModule**
[DependsOn(
typeof(MyApplicationModule),
typeof(MyDomainTestModule)
)]
public class MyApplicationTestModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
var builder = new ConfigurationBuilder();
Configure\<AbpUnitOfWorkDefaultOptions>(options =>
{
options.TransactionBehavior = UnitOfWorkTransactionBehavior.Disabled;
});
context.Services.AddAlwaysDisableUnitOfWorkTransaction();
}
}
Thank you, Gizem
Hello, We use the Notification module as nuget package in our shell project. Normally everything works fine with dependencies, but when we run the tests we are getting the specific error. Here is the some screenshots in detail:
About my application module:
[DependsOn(
typeof(PcdmsDomainModule),
typeof(PcdmsApplicationContractsModule),
typeof(AbpIdentityApplicationModule),
typeof(AbpAutoMapperModule),
typeof(AbpAspNetCoreSignalRModule),
typeof(AbpDddApplicationModule),
typeof(AbpEventBusRabbitMqModule),
typeof(TextTemplateManagementApplicationModule),
typeof(AbpTextTemplatingRazorModule),
typeof(NotificationApplicationModule),
typeof(DataManagementApplicationModule),
typeof(ProcessManagementApplicationModule),
typeof(AbpSettingManagementApplicationModule)
)]
public class PcdmsApplicationModule : AbpModule
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
...
}
}
**About Notification Module Application Layer**
[DependsOn(
typeof(NotificationDomainModule),
typeof(NotificationApplicationContractsModule),
typeof(AbpDddApplicationModule),
typeof(AbpAutoMapperModule)
)]
public class NotificationApplicationModule : AbpModule
{
public override void OnPreApplicationInitialization(ApplicationInitializationContext context)
{
var app = context.GetApplicationBuilder();
app.UseMiddleware();
}
...
}
When I run all tests, it gives an error like below: Siemens.PSSX.Pcdms.Areas.AreasAppServiceTests.CreateAsync Source: AreaApplicationTests.cs line 47 Duration: 1 ms
Message: Volo.Abp.AbpInitializationException : An error occurred during the initialize Volo.Abp.Modularity.OnPreApplicationInitializationModuleLifecycleContributor phase of the module Siemens.PSSX.Notification.NotificationApplicationModule, Siemens.PSSX.Notification.Application, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null: Object reference not set to an instance of an object.. See the inner exception for details. ---- System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
ModuleManager.InitializeModules(ApplicationInitializationContext context)
AbpApplicationBase.InitializeModules()
AbpApplicationWithExternalServiceProvider.Initialize(IServiceProvider serviceProvider)
AbpIntegratedTest1.ctor() PcdmsTestBase
1.ctor()
PcdmsApplicationTestBase.ctor()
AreasAppServiceTests.ctor() line 16
RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean wrapExceptions)
----- Inner Stack Trace -----
UseMiddlewareExtensions.UseMiddlewareInterface(IApplicationBuilder app, Type middlewareType)
NotificationApplicationModule.OnPreApplicationInitialization(ApplicationInitializationContext context)
OnPreApplicationInitializationModuleLifecycleContributor.Initialize(ApplicationInitializationContext context, IAbpModule module)
ModuleManager.InitializeModules(ApplicationInitializationContext context)
It seems to us, UseMiddleware of OnPreApplicationInitialization part causes that. (when we comment the notification module in PcdmsApplicationModule , all passed.) Could you please inform us about how we should apply or use middleware part to our test application? Many thanks, Gizem
Hello maliming, Is there any update about situation of this issue ?
Thank you. Gizem
If you want, I can e-mail you the new project I created as zip. Screenshots are as follows.
I kindly ask for your help and suggestions. Thank you.
Thank you maliming. I'll close the issue. Have a nice day.
Hi Again, I just shared my new template project with you. ( sender: ozdemir.gizem@siemens.com)
Thank you for your time.
Hello Team, I have extended a 'DirectoryDescriptor' , 'FileDescriptor' entities and their dtos of 'FileManagement' module and added a new string type field ,called as 'TestField'. I have configured both entities and I observed that it works properly. I also mapped EFCore property to hold it as a separate column instead of extraProperties column.
However, I am unable to sort 'TestField' because it gives me the following error: [12:36:14 ERR] No property or field 'TestField' exists in type 'DirectoryDescriptor'
I have seen this issue that mentions a similar problem: https://support.abp.io/QA/Questions/4643/Column-sorts-not-working-in-dependent-module-listings---Blazor-Server
Is this issue fixed on newer versions of the ABP framework. Thank you for your time. Kind Regards, Gizem
Hello , I want to add 'export' button on all abp generated tables to export data as excel/pdf file. But we don't use source code both frontend (angular ) side and backend side. Current situation we just called library on configuration files. So should i customize backend -identity related page's code (mvc) - and add buttons & implementation ? If yes could you please give an information about it ?
For example , i need export those tables' data : (role,user,security log,audit logs etc.)
Thank you, Have a nice day.
Hi,
Thank you. I get it.
Regards.
Hi liangshiwei,
Thx for your answer, I have tried IOptions and IOptionsSnapshot also. We can update value, but connections is not refreshed or updated with new hostname. Am i missing something ?
Regards. Mehmet