这是indexloc提供的服务,不要输入任何密码
Skip to content

Refactor DisableAuditingAttribute to allow it to ignore changes to AuditProperties. #23174

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

maliming
Copy link
Member

@maliming maliming commented Jun 25, 2025

Resolve #23168


Ignore Update Audit Properties And Publish Entity Updated Event

The [DisableAuditing] attribute supports additional configuration options when applied to entity properties.

  • UpdateModificationProps (default: true): When set to false, changes to this entity property will not update audit properties (like LastModificationTime.
  • PublishEntityEvent (default: true): When set to false, changes to this entity property will not publish entity change events (EntityUpdatedEvent).
public class MyUser : Entity<Guid>
{
    public string Name { get; set; }

    [DisableAuditing(UpdateModificationProps = false, PublishEntityEvent = false)]
    public string ReadCount { get; set; }
}

This example will ignore update audit properties and publish entity updated event when the ReadCount property is updated.

The UpdateModificationProps and PublishEntityEvent only work for Entity Framework Core. It will not work for MongoDB.

@maliming maliming added this to the 10.0-preview milestone Jun 25, 2025
@maliming maliming marked this pull request as draft June 25, 2025 05:56
@maliming maliming marked this pull request as ready for review July 7, 2025 09:13
@maliming maliming requested a review from hikalkan July 10, 2025 05:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Supports ignoring changes to the AuditProperties when special properties are modified.
1 participant