question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to override reason while saving Entity History

See original GitHub issue

I have used Entity History documentation on Abp Zero AspNetCore Template for Entity History feature. Used both UseCase Attribute & IEntityChangeSetReasonProvider to override the reason but it is still saving request display URL in database.

  • Abp package version. : 3.8.2
  • Base framework: .Net Core.
  • Steps to reproduce the problem.
  1. Used Abp Zero AspNetCore Template and used following options to configure Abp
return services.AddAbp<WebHostModule>(
                // Configure Serilog logging
                options =>
                {
                    options.IocManager.IocContainer.AddFacility<LoggingFacility>(
                                    f => f.LogUsing(new SerilogFactory()));
                    options.IocManager.Register(typeof(ILogger<>), typeof(Logger<>));
                }
           );
  1. Create any Audited entity and modify it in ApplicationService using following options: UseCase Attribute
[UseCase(Description = "Assign an issue to a user")]
public virtual async Task AssignIssueAsync(AssignIssueInput input)
{
    // ...
}

IEntityChangeSetReasonProvider

public class MyService
{
    private readonly IEntityChangeSetReasonProvider _reasonProvider;

    public MyService(IEntityChangeSetReasonProvider reasonProvider)
    {
        _reasonProvider = reasonProvider;
    }

    public virtual async Task AssignIssueAsync(AssignIssueInput input)
    {
        var reason = "Assign an issue to user: " + input.UserId.ToString();
        using (_reasonProvider.Use(reason))
        {
            ...
            _unitOfWorkManager.Current.SaveChanges();
        }
    }
}

Am I missing any configuration?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (7 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

Entity Framework 4.1 DbContext Override SaveChanges to ...
I am trying to implement a constrained 'audit log' of property changes to a properties in a set of classes. I have successfully...
Read more >
Not able to implement Entity History in ABP Framework, Why ...
I'm trying to implement an Audit/History table for my Entity so that I can see the deleted and old column values for a...
Read more >
Hibernate Envers for Auditing
With Hibernate Envers, it is easy to document and audit all changes on the persisted Entities. History of an entity with all changes...
Read more >
Overriding the save method - Django Models
We can override save function before storing the data in the database to apply some constraint or fill some ready only fields like...
Read more >
Working with Transactions - EF6
UseTransaction() to clear Entity Framework's knowledge of the current transaction. Entity Framework will neither commit nor rollback the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found