TablePrefix Not Being Used
I have a test project in which my DbContext's OnModelCreating method configures the table prefix for each module:
modelBuilder.ConfigureSettingManagement("MyPrefix");
When I create a Migration the table is created as MyPrefixSettings as expected. However, when running the project I get an error that AbpSettings is an invalid object - which it is since I've changed the prefix.
Should I be defining the prefix elsewhere in the code? Is there a global setting somewhere to override the TablePrefix for all Abp Entities like in the previous version?
Thanks.
I can reproduce the problem you mentioned.
https://github.com/abpframework/abp/blob/287f71d805cef27a221e6eead02fec59b6e62187/modules/setting-management/src/Volo.Abp.SettingManagement.EntityFrameworkCore/Volo/Abp/SettingManagement/EntityFrameworkCore/SettingManagementDbContext.cs#L22-L27
It seems to be overriding the configuration of the custom table prefix.
Try to set SettingManagementDbContext.TablePrefix property in your ConfigureServices method. It is not constant, it is static.
Try to set SettingManagementDbContext.TablePrefix property in your ConfigureServices method. It is not constant, it is static.
This works. I updated my code to use SettingManagementDbContext.TablePrefix = "MyPrefix" and it no longer fails to find the table so that's honoring the value correctly. I did the same for other modules such as PermissionManagementDbContext.TablePrefix and seems to be working correctly.
I'm closing because this is by design :)