Base solution for your next web application
Open Closed

Entity history when using multiple db contexts #10796


User avatar
0
MazarsDE created
  • product version 10.3
  • product type => Angular
  • product framework type => .net core

Hello, we are using multiple db contexts inside our application in order to separate different software functionalities (different modules). The original db context delivered by the template is still used for all original and predefined ZERO-template entities.

We now tried to switch on entity history which is working fine for the original db context and entities managed by it ("User", "OrganizationUnit" etc.). However, changes to entities handled by one of our additional db contexts are not tracket et all, although we have added them to the list of tracked items in EntityHistoryHelper. Is there any documentation or tutorial on how to use entity history with multiple db contexts?

Our wish is to have all tracked data inside the original db context (tables dbo.AbpEntityChanges, dbo.AbpEntityChangeSets, dbo.AbpEntityPropertyChanges) whilst the persistence of entities itself is handled in our module-specific db contexts. But we are happy about every suggestion leading to a working approach!

Many thanks!


6 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @MazarsDE

    Is your second DbContext inherited from AbpDbContext ?

  • User Avatar
    0
    MazarsDE created

    Hi, yes, our DbContexts inherit from AbpDbContext.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    In that case, it should be working. Is it possible to provide access to your project for us ?

    Thanks,

  • User Avatar
    0
    MazarsDE created

    Hi @ismcagdas,

    can you please contact me at [email protected] in order to provide you access.

    Many thanks!

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Thanks, an email has been sent.

  • User Avatar
    0
    MazarsDE created

    For those who face the same problem, follow this issue: https://github.com/aspnetboilerplate/aspnetboilerplate/issues/6371