LocalEvent is not triggered when only fields with default values are modified
Is there an existing issue for this?
- [X] I have searched the existing issues
Description
I use EntityFrameWorkCore,has a table and a field with default value.The context's ModelBuilder like:
protected override void OnModelCreating(ModelBuilder builder) { builder.Entity<Table1>(e => { e.Property(b => b.Field1).HasDefaultValue(1); } }
The EF will make the proerty Metadata.ValueGenerated=ValueGenerated.OnAdd. Now i just modify the field only('Field1' in previous code),and SaveChangesAsync(). But the ILocalEventHandler<EntityChangedEventData<Table1>> is not triggered.
Reproduction Steps
No response
Expected behavior
No response
Actual behavior
No response
Regression?
No response
Known Workarounds
AbpDbContext<TDbContext>.PublishEventsForTrackedEntity(EntityEntry entry) { ... - if (entry.Properties.Any(x => x.IsModified && x.Metadata.ValueGenerated == ValueGenerated.Never) + if (entry.Properties.Any(x => x.IsModified && (x.Metadata.ValueGenerated == ValueGenerated.Never || x.Metadata.ValueGenerated == ValueGenerated.OnAdd)) ... }
Modification as above will solve the problem.
Version
7.3.1
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Linux
Other information
No response
Even if Event is fired, The value in the event data is still not correct.