The following UpdateRoleAsync method works just fine with Mapster 7.4 but when I updated to Mapster 10 I am getting Reference constraint violatation from EF core because Mapster is modifying every other propery to default value that are not present in the DTO. I have to roll back to Mapster 7.4 to save the app from huge breaking change. How to get the old behavior back??
publicrecordAuthorizableRoleRequest(stringName,boolIsActive);publicclassAuthorizableRole:IAutoIncrementalEntity<long>{publiclongId{get;}publicrequiredstringName{get;set;}publicrequiredstringNormalizedName{get;set;}publicrequiredboolIsActive{get;set;}publicrequiredlongCreatedByUserId{get;init;}publicrequiredlong?UpdatedByUserId{get;set;}publicrequiredDateTimeCreatedAtUtc{get;init;}publicrequiredDateTime?UpdatedAtUtc{get;set;}}publicasyncTask<ValueOutcome<Successful,IBadOutcome<HttpBadOutcomeTag>>>UpdateRoleAsync(longroleId,AuthorizableRoleRequestrequest,UserIduserId,CancellationTokenct){varentity=await_appDbContext.AuthorizableRoles.FirstOrDefaultAsync(x =>x.Id==roleId,ct);if(entityisnull){returnnewHttpBadOutcome(HttpBadOutcomeTag.NotFound);}varnormalizedName=request.Name.ToUpperInvariant();varexists=await_appDbContext.AuthorizableRoles.AnyAsync(x =>x.Id!=entity.Id&&x.NormalizedName==normalizedName,ct);if(exists){returnnewHttpBadOutcome(HttpBadOutcomeTag.Conflict);}awaitrequest.BuildAdapter().AdaptToAsync(entity);entity.NormalizedName=normalizedName;entity.RefreshUpdateTrackingData(userId,_dateTimeProvider.UtcNow);_appDbContext.AuthorizableRoles.Update(entity);await_appDbContext.SaveChangesAsync();returnnewSuccessful();}
The following
UpdateRoleAsyncmethod works just fine with Mapster 7.4 but when I updated to Mapster 10 I am getting Reference constraint violatation from EF core because Mapster is modifying every other propery to default value that are not present in the DTO. I have to roll back to Mapster 7.4 to save the app from huge breaking change. How to get the old behavior back??