@muhammedaltug I have been able to solve the problem using your provided code sample. Thank you!
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.
If you're creating a bug/problem report, please include followings:
Hello
I have been developing dynamic theming functionality for our application so that tenants can select their own colour schemes, logo and background images at runtime with only minimal Lepton Theme sourcecode integration to achieve it (allowing for easier Abp Framework version upgrades). I've been weighing up whether to write a community article sharing how it can be done (time permitting!). To give a brief summary of how it works -
Everything works really well and is close to feature completeness, but there is one issue presenting 'bug-like' behaviour that I would like to resolve before calling it 100% complete.
When a users swaps to a different tenant on an Identity Server page, the new tenants branding is loaded and all the colours update correctly. When you log in and are redirected back to the Angular client, the Angular client will be loaded with the previous tenants branding information instead of the new tenant.
It appears as though the branding information is being retrieved before the tenant cookie is being updated to use the new tenant id on the Angular side. If I refresh the page, the correct branding is loaded as the tenant cookie is now set with the new tenant id.
Is there a way within the APP_INITIALIZE phase to have the tenant cookie update first before my branding loading function is called? I don't know how to define this kind of relationship during app startup.
I have attached screenshots that I hope will clarify the issue
Thankyou
@albert @hikalkan
I see. Thankyou for clarifying what needs to be done. It is a shame that I can't define a navigation property on the IdentityUser entity given how much it would simplify things. Perhaps it could be a future feature or enhancement? Nevertheless, I have manually created the joining entity based on the code provided to solve my problem.
Thankyou again
Hi @albert
I've generated a sample TestEntity -> IdentityUser many to many relationship using the latest version of ABP Suite (5.2) and observed the outputed code. It appears to be setting up the relationship using the more traditional method of manually defining the joining entity, joining properties, database configuration etc.
EFCore 6 allows us to define many to many relationships between 2 entities directly in Fluent API without needing to manually define all the boilerplate code that the ABP Suite is creating to faciliate a many to many relationship. For reference please see Microsoft documentation here
In my situation the ABP Suite generated code in the screenshot above would simply be a 'HasMany()' -> 'WithMany()' definition i.e 2-3 lines of code without needing any joining entity defined. I'm trying to utilise this by defining the joins like you can see in this Microsoft documentation link and in the screenshots in my comment when first opening this issue.
The error when defining the join property using the EfCoreEntityExtensionMappings feature on the IdentityUser entity is what appears to be causing my issue.
I'd like to not have to manually define the join entities and all the boilerplate that goes with that when there's a supported feature of EFCore 6 that lets us do many to many in a very simple and clean way.
Additionally (and quite importantly for our requirements), using the ABP Suite to generate the code doesn't seem to allow me to pull a list of users out the database and access the associated entities on the join property (TestEntities) as it doesn't exist in this implementation. The way I'm trying to do it (theoretically) should allow me to do this.
Should EfCoreEntityExtensionMappings support the ability to define a navigation property on IdentityUser (i.e my issue is a bug), or is this an enhancement that could be made to support this?
Thankyou
The service bot automatically closed this issue. Bumping to reopen it.
Has there been any further progress on this one since last week?
Thankyou
Hello
Just checking in to see if there are any updates on this one?
Thankyou
Hi
I'm attempting to add a many-to-many relationship between my aggregate root and the built in IdentityUser class using the EF Core Fluent API. I'm am having trouble defining this relationship.
Once the relationship is defined it is my intention to be able to pull a user out of the database and '.Include()' the navigation property defined on the IdentityUser to get a list of ActivityInstances they are part of (and vice versa).
Could you please advise on what I am doing wrong and whether I need to approach this differently to have a many-to-many with IdentityUser or whether this is a bug and that I should be able to reference the navigation property defined via the EntityExtensionMapping in the Fluent API?
ActivityInstance (my aggregate root)
SchedulerEfCoreEntityExtensionMappings
SchedulerDbContextModelCreatingExtensions
My understanding is that EF Core will automatically produce the joining table with the appropriate foreign keys configured. This works as intended with other many-to-many relationships I have defined between my other entities where I have direct control over the navigation properties defined in those classes as shown here
I'm aware that the property definition in the SchedulerEfCoreEntityExtensionMappings file might interfer with how EF Core automatically configures the joining table with the appropriate foreign keys but I'm not sure.
Thankyou
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.
If you're creating a bug/problem report, please include followings:
<br> Hello I was taking a look at integrating the commercial Forms Module (https://commercial.abp.io/modules/Volo.Forms) into my application but I saw it was only supported in the MVC UI framework and not Angular. <br>
Thank you
@albert
Yes, all of our clients are currently on 4.3.X
If the fix is small, perhaps I can apply it manually until we schedule the work in to perform the upgrades to 4.4.X
What do you think?
Hi @albert
Are you able to tell me which of the releases the fix will be available in? 4.3-patch, 4.4-patch or 5.0?
Thankyou