@@ -114,10 +114,10 @@ internal Dictionary<string, Type> GetEntityMap(OfflineDbContext context)
114114 /// <param name="cancellationToken">A <see cref="CancellationToken"/> to observe.</param>
115115 /// <returns>The operation entity or null if one does not exist.</returns>
116116 /// <exception cref="DatasyncException">Thrown if the entity ID of the provided entity is invalid.</exception>
117- internal async ValueTask < DatasyncOperation ? > GetExistingOperationAsync ( object entity , CancellationToken cancellationToken = default )
117+ internal async ValueTask < DatasyncOperation ? > GetExistingOperationAsync ( EntityEntry entityEntry , CancellationToken cancellationToken = default )
118118 {
119- Type entityType = entity . GetType ( ) ;
120- EntityMetadata metadata = EntityResolver . GetEntityMetadata ( entity , entityType ) ;
119+ Type entityType = entityEntry . Metadata . ClrType ;
120+ EntityMetadata metadata = EntityResolver . GetEntityMetadata ( entityEntry . Entity , entityType ) ;
121121 if ( ! EntityResolver . EntityIdIsValid ( metadata . Id ) )
122122 {
123123 throw new DatasyncException ( $ "Entity ID for type { entityType . FullName } is invalid.") ;
@@ -143,7 +143,7 @@ internal Task<long> GetLastSequenceIdAsync(CancellationToken cancellationToken =
143143 /// <returns>The operation definition.</returns>
144144 internal DatasyncOperation GetOperationForChangedEntity ( EntityEntry entry )
145145 {
146- Type entityType = entry . Entity . GetType ( ) ;
146+ Type entityType = entry . Metadata . ClrType ;
147147 EntityMetadata metadata = EntityResolver . GetEntityMetadata ( entry . Entity , entityType ) ;
148148 if ( ! EntityResolver . EntityIdIsValid ( metadata . Id ) )
149149 {
@@ -432,7 +432,7 @@ public async Task UpdateOperationsQueueAsync(CancellationToken cancellationToken
432432 foreach ( EntityEntry entry in entitiesInScope )
433433 {
434434 DatasyncOperation newOperation = GetOperationForChangedEntity ( entry ) ;
435- DatasyncOperation ? existingOperation = await GetExistingOperationAsync ( entry . Entity , cancellationToken ) . ConfigureAwait ( false ) ;
435+ DatasyncOperation ? existingOperation = await GetExistingOperationAsync ( entry , cancellationToken ) . ConfigureAwait ( false ) ;
436436 if ( existingOperation is null )
437437 {
438438 newOperation . Sequence = Interlocked . Increment ( ref sequenceId ) ;
0 commit comments