File tree Expand file tree Collapse file tree 6 files changed +429
-27
lines changed
Expand file tree Collapse file tree 6 files changed +429
-27
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ namespace CommunityToolkit.Datasync.Server.EntityFrameworkCore;
1010/// <summary>
1111/// The base class for all the Entity Framework Core based table data classes.
1212/// </summary>
13- [ Index ( nameof ( UpdatedAt ) , nameof ( Deleted ) ) ]
1413public abstract class BaseEntityTableData : ITableData
1514{
1615 /// <inheritdoc />
Original file line number Diff line number Diff line change 22// The .NET Foundation licenses this file to you under the MIT license.
33// See the LICENSE file in the project root for more information.
44
5+ using Microsoft . EntityFrameworkCore ;
56using System . ComponentModel . DataAnnotations ;
67using System . ComponentModel . DataAnnotations . Schema ;
78
@@ -11,6 +12,7 @@ namespace CommunityToolkit.Datasync.Server.EntityFrameworkCore;
1112/// A version of the <see cref="BaseEntityTableData"/> that is compatible with
1213/// most of the Entity Framework Core drivers.
1314/// </summary>
15+ [ Index ( nameof ( UpdatedAt ) , nameof ( Deleted ) ) ]
1416public class EntityTableData : BaseEntityTableData
1517{
1618 /// <inheritdoc />
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ public virtual async ValueTask CreateAsync(TEntity entity, CancellationToken can
138138 await WrapExceptionAsync ( entity . Id , async ( ) =>
139139 {
140140 // We do not use Any() here because it is not supported by all providers (e.g. Cosmos)
141- if ( DataSet . Count ( x => x . Id == entity . Id ) > 0 )
141+ if ( ( await DataSet . CountAsync ( x => x . Id == entity . Id , cancellationToken ) ) > 0 )
142142 {
143143 throw new HttpException ( ( int ) HttpStatusCode . Conflict ) { Payload = await GetEntityAsync ( entity . Id , cancellationToken ) . ConfigureAwait ( false ) } ;
144144 }
You can’t perform that action at this time.
0 commit comments