Browse Source

Add cancellationtoken to the repositories.

pull/5067/head
Halil İbrahim Kalkan 6 years ago
parent
commit
064704669b
  1. 10
      modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Reactions/IUserReactionRepository.cs
  2. 16
      modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs
  3. 16
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Reactions/MongoUserReactionRepository.cs
  4. 1
      modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Users/MongoCmsUserRepository.cs

10
modules/cms-kit/src/Volo.CmsKit.Domain/Volo/CmsKit/Reactions/IUserReactionRepository.cs

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

16
modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs

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

16
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Reactions/MongoUserReactionRepository.cs

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

1
modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Users/MongoCmsUserRepository.cs

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

Loading…
Cancel
Save