Add cancellationtoken to the repositories.

pull/5067/head
Halil İbrahim Kalkan 5 years ago
parent 1e93a4474c
commit 064704669b

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Volo.Abp.Domain.Repositories;
@ -12,18 +13,21 @@ namespace Volo.CmsKit.Reactions
Guid userId,
[NotNull] string entityType,
[NotNull] string entityId,
[NotNull] string reactionName
[NotNull] string reactionName,
CancellationToken cancellationToken = default
);
Task<List<UserReaction>> GetListForUserAsync(
Guid userId,
[NotNull] string entityType,
[NotNull] string entityId
[NotNull] string entityId,
CancellationToken cancellationToken = default
);
Task<List<ReactionSummaryQueryResultItem>> GetSummariesAsync(
[NotNull] string entityType,
[NotNull] string entityId
[NotNull] string entityId,
CancellationToken cancellationToken = default
);
}
}

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Volo.Abp;
@ -22,7 +23,8 @@ namespace Volo.CmsKit.Reactions
Guid userId,
string entityType,
string entityId,
string reactionName)
string reactionName,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -34,13 +36,14 @@ namespace Volo.CmsKit.Reactions
x.EntityType == entityType &&
x.EntityId == entityId &&
x.ReactionName == reactionName)
.FirstOrDefaultAsync();
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<UserReaction>> GetListForUserAsync(
Guid userId,
string entityType,
string entityId)
string entityId,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -50,12 +53,13 @@ namespace Volo.CmsKit.Reactions
x.CreatorId == userId &&
x.EntityType == entityType &&
x.EntityId == entityId)
.ToListAsync();
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<ReactionSummaryQueryResultItem>> GetSummariesAsync(
string entityType,
string entityId)
string entityId,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -70,7 +74,7 @@ namespace Volo.CmsKit.Reactions
ReactionName = g.Key,
Count = g.Count()
})
.ToListAsync();
.ToListAsync(GetCancellationToken(cancellationToken));
}
}
}

@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MongoDB.Driver;
using MongoDB.Driver.Linq;
@ -21,7 +22,8 @@ namespace Volo.CmsKit.MongoDB.Reactions
Guid userId,
string entityType,
string entityId,
string reactionName)
string reactionName,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -33,13 +35,14 @@ namespace Volo.CmsKit.MongoDB.Reactions
x.EntityType == entityType &&
x.EntityId == entityId &&
x.ReactionName == reactionName)
.FirstOrDefaultAsync();
.FirstOrDefaultAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<UserReaction>> GetListForUserAsync(
Guid userId,
string entityType,
string entityId)
string entityId,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -49,12 +52,13 @@ namespace Volo.CmsKit.MongoDB.Reactions
x.CreatorId == userId &&
x.EntityType == entityType &&
x.EntityId == entityId)
.ToListAsync();
.ToListAsync(GetCancellationToken(cancellationToken));
}
public async Task<List<ReactionSummaryQueryResultItem>> GetSummariesAsync(
string entityType,
string entityId)
string entityId,
CancellationToken cancellationToken = default)
{
Check.NotNullOrWhiteSpace(entityType, nameof(entityType));
Check.NotNullOrWhiteSpace(entityId, nameof(entityId));
@ -69,7 +73,7 @@ namespace Volo.CmsKit.MongoDB.Reactions
ReactionName = g.Key,
Count = g.Count()
})
.ToListAsync();
.ToListAsync(GetCancellationToken(cancellationToken));
}
}
}

@ -10,6 +10,5 @@ namespace Volo.CmsKit.MongoDB.Users
: base(dbContextProvider)
{
}
}
}

Loading…
Cancel
Save