We are using multiple databases for the our project. Now we have created a custom implementation for IEntityHistoryStore and used it to replace the default implementation. Also, we have uncommented lines to write change logs for the entities and added the entity type for Entity History selectors. The problem is that Entity History works for entities stored in the one database and doesn't work for entities stored in another databases. Do you have any suggestions for that?
The version of Asp.net Zero is v6.6.0 and we are using EntityFramework Core.
4 Answer(s)
-
0
Hi, do you mean the entities of another database do not have entity history?
Can you explain how were the multiple databases implemented? Are they being implemented as different DbContext?
-
0
Hi,
We have 2 databases and 2 dbContext and each has its own entities. The one which was created by default with aspnetzero works fine with EntityHistory and the one we added as second database is having issues.
thanks
-
0
Hi, was the second db context inherit from
AbpZeroCommonDbContext
?if not, you will have to override the
SaveChanges
method and callEnityHistoryHelper
yourself.See https://github.com/aspnetboilerplate/aspnetboilerplate/blob/c8123513d66cec6788cd90871c5ced68be21b861/src/Abp.ZeroCore.EntityFrameworkCore/Zero/EntityFrameworkCore/AbpZeroCommonDbContext.cs#L155-L178
-
0
Thanks a lot, ryancyq. Your solution works. Our second db context is just inherited from AbpDbContext.