Product type: ASP.NET Core + Angular Version: 7.0.0
I have a requirement to add a new property to History related table, AbpEntityChange
to be precise.
I am able to do this by following Extending Existing Entities.
I just couldn't find the file where I can modify the newly added property i.e. I want to modify or add value to this property when a new entity of AbpEntityChange
is created.
Please let me know the area where these changes are currently being made in my application.
Thanks
3 Answer(s)
-
0
Hi @ptaylor
You can define your own EntityHistoryHelper class which inherits from https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.ZeroCore.EntityFrameworkCore/EntityHistory/EntityHistoryHelper.cs and replace your implementation with default one in dependency injection using code below in your EF Core module's PreInitialize method;
Configuration.ReplaceService<IEntityHistoryHelper, MyEntityHistoryHelper>();
Than, youy can override any method in your MyEntityHistoryHelper class and set necessary properties you want.
-
0
Thanks for your reply @ismcagdas.
There is some followup questions against your reply:
- Do we have to upgrade from v7.0.0 to the latest verision?
- In our version, the file EntityHistoryHelper is in MyProject.Core rather than MyProject.EntityFrameworkCore and also there is a very little code in my current EntityHistoryHelper. And our app couldn't even find EntityHistoryHelperBase to extend from.
Please help.
-
0
Hi,
- You don't have to upgrade AspNet Zero but you need to upgrade ABP NuGet packages.
- Sorry, you can place it in Core project. https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp/EntityHistory/EntityHistoryHelperBase.cs added recently. If you upgrade ABP NuGet packages, you can use it.