diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs index 58eefeba5e..e09bfc4d30 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationLocalizationAppService.cs @@ -24,7 +24,7 @@ public class AbpApplicationLocalizationAppService : LocalizationOptions = localizationOptions.Value; } - public async Task GetAsync(ApplicationLocalizationRequestDto input) + public virtual async Task GetAsync(ApplicationLocalizationRequestDto input) { if (!CultureHelper.IsValidCultureCode(input.CultureName)) { diff --git a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs index 3b2b14f952..b9f061b9aa 100644 --- a/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs +++ b/framework/src/Volo.Abp.Dapper/Volo/Abp/Domain/Repositories/Dapper/DapperRepository.cs @@ -36,12 +36,12 @@ public class DapperRepository : IDapperRepository, IUnitOfWorkEnable [Obsolete("Use GetDbConnectionAsync method.")] public IDbConnection DbConnection => _dbContextProvider.GetDbContext().Database.GetDbConnection(); - public async Task GetDbConnectionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.GetDbConnection(); + public virtual async Task GetDbConnectionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.GetDbConnection(); [Obsolete("Use GetDbTransactionAsync method.")] public IDbTransaction DbTransaction => _dbContextProvider.GetDbContext().Database.CurrentTransaction?.GetDbTransaction(); - public async Task GetDbTransactionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.CurrentTransaction?.GetDbTransaction(); + public virtual async Task GetDbTransactionAsync() => (await _dbContextProvider.GetDbContextAsync()).Database.CurrentTransaction?.GetDbTransaction(); protected virtual CancellationToken GetCancellationToken(CancellationToken preferredValue = default) { diff --git a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs index cfddbc6464..39b2247a61 100644 --- a/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs +++ b/framework/src/Volo.Abp.MemoryDb/Volo/Abp/Domain/Repositories/MemoryDb/MemoryDbRepository.cs @@ -25,7 +25,7 @@ public class MemoryDbRepository : RepositoryBase Collection => Database.Collection(); - public async Task> GetCollectionAsync() + public virtual async Task> GetCollectionAsync() { return (await GetDatabaseAsync()).Collection(); } diff --git a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs index 6c009894e3..9180b80b2c 100644 --- a/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs +++ b/framework/src/Volo.Abp.MongoDB/Volo/Abp/Domain/Repositories/MongoDB/MongoDbRepository.cs @@ -30,7 +30,7 @@ public class MongoDbRepository [Obsolete("Use GetCollectionAsync method.")] public virtual IMongoCollection Collection => DbContext.Collection(); - public async Task> GetCollectionAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetCollectionAsync(CancellationToken cancellationToken = default) { return (await GetDbContextAsync(GetCancellationToken(cancellationToken))).Collection(); } @@ -38,7 +38,7 @@ public class MongoDbRepository [Obsolete("Use GetDatabaseAsync method.")] public virtual IMongoDatabase Database => DbContext.Database; - public async Task GetDatabaseAsync(CancellationToken cancellationToken = default) + public virtual async Task GetDatabaseAsync(CancellationToken cancellationToken = default) { return (await GetDbContextAsync(GetCancellationToken(cancellationToken))).Database; } diff --git a/modules/blogging/src/Volo.Blogging.Admin.Application/Volo/Blogging/Admin/Blogs/BlogManagementAppService.cs b/modules/blogging/src/Volo.Blogging.Admin.Application/Volo/Blogging/Admin/Blogs/BlogManagementAppService.cs index d24240b64c..88dccd69f8 100644 --- a/modules/blogging/src/Volo.Blogging.Admin.Application/Volo/Blogging/Admin/Blogs/BlogManagementAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Admin.Application/Volo/Blogging/Admin/Blogs/BlogManagementAppService.cs @@ -22,7 +22,7 @@ namespace Volo.Blogging.Admin.Blogs _postsCache = postsCache; } - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { var blogs = await _blogRepository.GetListAsync(); @@ -31,7 +31,7 @@ namespace Volo.Blogging.Admin.Blogs ); } - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { var blog = await _blogRepository.GetAsync(id); @@ -39,7 +39,7 @@ namespace Volo.Blogging.Admin.Blogs } [Authorize(BloggingPermissions.Blogs.Create)] - public async Task CreateAsync(CreateBlogDto input) + public virtual async Task CreateAsync(CreateBlogDto input) { var newBlog = new Blog(GuidGenerator.Create(), input.Name, input.ShortName) { @@ -52,7 +52,7 @@ namespace Volo.Blogging.Admin.Blogs } [Authorize(BloggingPermissions.Blogs.Update)] - public async Task UpdateAsync(Guid id, UpdateBlogDto input) + public virtual async Task UpdateAsync(Guid id, UpdateBlogDto input) { var blog = await _blogRepository.GetAsync(id); @@ -65,13 +65,13 @@ namespace Volo.Blogging.Admin.Blogs } [Authorize(BloggingPermissions.Blogs.Delete)] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { await _blogRepository.DeleteAsync(id); } [Authorize(BloggingPermissions.Blogs.ClearCache)] - public async Task ClearCacheAsync(Guid id) + public virtual async Task ClearCacheAsync(Guid id) { await _postsCache.RemoveAsync(id.ToString()); } diff --git a/modules/blogging/src/Volo.Blogging.Admin.HttpApi/Volo/Blogging/Admin/BlogManagementController.cs b/modules/blogging/src/Volo.Blogging.Admin.HttpApi/Volo/Blogging/Admin/BlogManagementController.cs index 0a0c092081..8580076e05 100644 --- a/modules/blogging/src/Volo.Blogging.Admin.HttpApi/Volo/Blogging/Admin/BlogManagementController.cs +++ b/modules/blogging/src/Volo.Blogging.Admin.HttpApi/Volo/Blogging/Admin/BlogManagementController.cs @@ -23,41 +23,41 @@ namespace Volo.Blogging.Admin } [HttpGet] - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { return await _blogManagementAppService.GetListAsync(); } [HttpGet] [Route("{id}")] - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { return await _blogManagementAppService.GetAsync(id); } [HttpPost] - public async Task CreateAsync(CreateBlogDto input) + public virtual async Task CreateAsync(CreateBlogDto input) { return await _blogManagementAppService.CreateAsync(input); } [HttpPut] [Route("{id}")] - public async Task UpdateAsync(Guid id, UpdateBlogDto input) + public virtual async Task UpdateAsync(Guid id, UpdateBlogDto input) { return await _blogManagementAppService.UpdateAsync(id, input); } [HttpDelete] [Route("{id}")] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { await _blogManagementAppService.DeleteAsync(id); } [HttpGet] [Route("clear-cache/{id}")] - public async Task ClearCacheAsync(Guid id) + public virtual async Task ClearCacheAsync(Guid id) { await _blogManagementAppService.ClearCacheAsync(id); } diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Blogs/BlogAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Blogs/BlogAppService.cs index a65d92db30..009baaf028 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Blogs/BlogAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Blogs/BlogAppService.cs @@ -18,7 +18,7 @@ namespace Volo.Blogging.Blogs BlogRepository = blogRepository; } - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { var blogs = await BlogRepository.GetListAsync(); @@ -27,7 +27,7 @@ namespace Volo.Blogging.Blogs ); } - public async Task GetByShortNameAsync(string shortName) + public virtual async Task GetByShortNameAsync(string shortName) { Check.NotNullOrWhiteSpace(shortName, nameof(shortName)); @@ -41,7 +41,7 @@ namespace Volo.Blogging.Blogs return ObjectMapper.Map(blog); } - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { var blog = await BlogRepository.GetAsync(id); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs index 21daa5c3d3..14c4a134c0 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Comments/CommentAppService.cs @@ -23,7 +23,7 @@ namespace Volo.Blogging.Comments UserLookupService = userLookupService; } - public async Task> GetHierarchicalListOfPostAsync(Guid postId) + public virtual async Task> GetHierarchicalListOfPostAsync(Guid postId) { var comments = await GetListOfPostAsync(postId); var userDictionary = new Dictionary(); @@ -79,7 +79,7 @@ namespace Volo.Blogging.Comments } [Authorize] - public async Task CreateAsync(CreateCommentDto input) + public virtual async Task CreateAsync(CreateCommentDto input) { var comment = new Comment(GuidGenerator.Create(), input.PostId, input.RepliedCommentId, input.Text); @@ -91,7 +91,7 @@ namespace Volo.Blogging.Comments } [Authorize] - public async Task UpdateAsync(Guid id, UpdateCommentDto input) + public virtual async Task UpdateAsync(Guid id, UpdateCommentDto input) { var comment = await CommentRepository.GetAsync(id); @@ -106,7 +106,7 @@ namespace Volo.Blogging.Comments } [Authorize] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { var comment = await CommentRepository.GetAsync(id); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs index afc5eac0b6..4ef8e72daf 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Members/MemberAppService.cs @@ -15,7 +15,7 @@ public class MemberAppService : BloggingAppServiceBase, IMemberAppService _userRepository = userRepository; } - public async Task FindAsync(string username) + public virtual async Task FindAsync(string username) { var user = await _userRepository.FindAsync(x => x.UserName == username); @@ -27,7 +27,7 @@ public class MemberAppService : BloggingAppServiceBase, IMemberAppService return ObjectMapper.Map(user); } - public async Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) + public virtual async Task UpdateUserProfileAsync(CustomIdentityBlogUserUpdateDto input) { var user = await _userRepository.GetAsync(CurrentUser.Id.Value); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs index 1983bd3cbf..d1825f4475 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Posts/PostAppService.cs @@ -42,7 +42,7 @@ namespace Volo.Blogging.Posts LocalEventBus = localEventBus; } - public async Task> GetListByBlogIdAndTagNameAsync(Guid id, string tagName) + public virtual async Task> GetListByBlogIdAndTagNameAsync(Guid id, string tagName) { var posts = await PostRepository.GetPostsByBlogId(id); var tag = tagName.IsNullOrWhiteSpace() ? null : await TagRepository.FindByNameAsync(id, tagName); @@ -82,7 +82,7 @@ namespace Volo.Blogging.Posts return new ListResultDto(postDtos); } - public async Task> GetTimeOrderedListAsync(Guid blogId) + public virtual async Task> GetTimeOrderedListAsync(Guid blogId) { var postCacheItems = await PostsCache.GetOrAddAsync( blogId.ToString(), @@ -110,7 +110,7 @@ namespace Volo.Blogging.Posts return new ListResultDto(postsWithDetails); } - public async Task GetForReadingAsync(GetPostInput input) + public virtual async Task GetForReadingAsync(GetPostInput input) { var post = await PostRepository.GetPostByUrl(input.BlogId, input.Url); @@ -130,7 +130,7 @@ namespace Volo.Blogging.Posts return postDto; } - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { var post = await PostRepository.GetAsync(id); @@ -149,7 +149,7 @@ namespace Volo.Blogging.Posts } [Authorize(BloggingPermissions.Posts.Delete)] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { var post = await PostRepository.GetAsync(id); @@ -164,7 +164,7 @@ namespace Volo.Blogging.Posts } [Authorize(BloggingPermissions.Posts.Update)] - public async Task UpdateAsync(Guid id, UpdatePostDto input) + public virtual async Task UpdateAsync(Guid id, UpdatePostDto input) { var post = await PostRepository.GetAsync(id); @@ -188,14 +188,14 @@ namespace Volo.Blogging.Posts return ObjectMapper.Map(post); } - public async Task> GetListByUserIdAsync(Guid userId) + public virtual async Task> GetListByUserIdAsync(Guid userId) { var posts = await PostRepository.GetListByUserIdAsync(userId); return ObjectMapper.Map, List>(posts); } - public async Task> GetLatestBlogPostsAsync(Guid blogId, int count) + public virtual async Task> GetLatestBlogPostsAsync(Guid blogId, int count) { var posts = await PostRepository.GetLatestBlogPostsAsync(blogId, count); var userDictionary = new Dictionary(); @@ -226,7 +226,7 @@ namespace Volo.Blogging.Posts } [Authorize(BloggingPermissions.Posts.Create)] - public async Task CreateAsync(CreatePostDto input) + public virtual async Task CreateAsync(CreatePostDto input) { input.Url = await RenameUrlIfItAlreadyExistAsync(input.BlogId, input.Url); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs index 9f82cb1844..e79905f55e 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Tagging/TagAppService.cs @@ -15,7 +15,7 @@ namespace Volo.Blogging.Tagging TagRepository = tagRepository; } - public async Task> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input) + public virtual async Task> GetPopularTagsAsync(Guid blogId, GetPopularTagsInput input) { var postTags = (await TagRepository.GetListAsync(blogId)).OrderByDescending(t=>t.UsageCount) .WhereIf(input.MinimumPostCount != null, t=>t.UsageCount >= input.MinimumPostCount) diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs index d5397a66f0..774c4f260e 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Blogs/EfCoreBlogRepository.cs @@ -16,7 +16,7 @@ namespace Volo.Blogging.Blogs } - public async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.ShortName == shortName, GetCancellationToken(cancellationToken)); } diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs index 801ef07825..58dc06c4cb 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Comments/EfCoreCommentRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Blogging.Comments { } - public async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) + public virtual async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(a => a.PostId == postId) @@ -25,19 +25,19 @@ namespace Volo.Blogging.Comments .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) + public virtual async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .CountAsync(a => a.PostId == postId, GetCancellationToken(cancellationToken)); } - public async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) + public virtual async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(a => a.RepliedCommentId == id).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) + public virtual async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) { var recordsToDelete = await (await GetDbSetAsync()).Where(pt => pt.PostId == id).ToListAsync(GetCancellationToken(cancellationToken)); (await GetDbSetAsync()).RemoveRange(recordsToDelete); diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs index 98d2d76685..c53f594785 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Posts/EfCorePostRepository.cs @@ -20,12 +20,12 @@ namespace Volo.Blogging.Posts } - public async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) + public virtual async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).Where(p => p.BlogId == id).OrderByDescending(p=>p.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) + public virtual async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) { var query = (await GetDbSetAsync()).Where(p => blogId == p.BlogId && p.Url == url); @@ -37,7 +37,7 @@ namespace Volo.Blogging.Posts return await query.AnyAsync(GetCancellationToken(cancellationToken)); } - public async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) + public virtual async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) { var post = await (await GetDbSetAsync()).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url, GetCancellationToken(cancellationToken)); @@ -49,7 +49,7 @@ namespace Volo.Blogging.Posts return post; } - public async Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default) + public virtual async Task> GetOrderedList(Guid blogId,bool descending = false, CancellationToken cancellationToken = default) { if (!descending) { @@ -62,7 +62,7 @@ namespace Volo.Blogging.Posts } - public async Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default) + public virtual async Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default) { var query = (await GetDbSetAsync()).Where(p => p.CreatorId == userId) .OrderByDescending(p => p.CreationTime); @@ -70,7 +70,7 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + public virtual async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) { var query = (await GetDbSetAsync()).Where(p => p.BlogId == blogId) .OrderByDescending(p => p.CreationTime) diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs index 0a33207374..a437209557 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Tagging/EfCoreTagRepository.cs @@ -17,27 +17,27 @@ namespace Volo.Blogging.Tagging { } - public async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).Where(t=>t.BlogId == blogId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) + public virtual async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).FirstAsync(t=> t.BlogId == blogId && t.Name == name, GetCancellationToken(cancellationToken)); } - public async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).FirstOrDefaultAsync(t => t.BlogId == blogId && t.Name == name, GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) + public virtual async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) { var tags = await (await GetDbSetAsync()) .Where(t => ids.Any(id => id == t.Id)) diff --git a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Users/EfCoreBlogUserRepository.cs b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Users/EfCoreBlogUserRepository.cs index fcc46a95cc..ec4c07a082 100644 --- a/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Users/EfCoreBlogUserRepository.cs +++ b/modules/blogging/src/Volo.Blogging.EntityFrameworkCore/Volo/Blogging/Users/EfCoreBlogUserRepository.cs @@ -17,7 +17,7 @@ namespace Volo.Blogging.Users } - public async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) { return await DbSet .WhereIf( !string.IsNullOrWhiteSpace( filter), x=>x.UserName.Contains(filter)) diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs index 7df9cba876..128cddfa9f 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs @@ -28,7 +28,7 @@ namespace Volo.Blogging [HttpGet] [Route("www/{name}")] - public async Task GetFileAsync(string name) + public virtual async Task GetFileAsync(string name) { return await _fileAppService.GetFileAsync(name); } diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs index a05d9d076c..db70716897 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs @@ -22,21 +22,21 @@ namespace Volo.Blogging } [HttpGet] - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { return await _blogAppService.GetListAsync(); } [HttpGet] [Route("by-shortname/{shortName}")] - public async Task GetByShortNameAsync(string shortName) + public virtual async Task GetByShortNameAsync(string shortName) { return await _blogAppService.GetByShortNameAsync(shortName); } [HttpGet] [Route("{id}")] - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { return await _blogAppService.GetAsync(id); } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs index 2577b8d3a0..42c8bb467a 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Blogs/MongoBlogRepository.cs @@ -14,7 +14,7 @@ namespace Volo.Blogging.Blogs { } - public async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task FindByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).FirstOrDefaultAsync(p => p.ShortName == shortName, GetCancellationToken(cancellationToken)); } diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs index 689e44abbd..89e5b6b575 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Comments/MongoCommentRepository.cs @@ -16,7 +16,7 @@ namespace Volo.Blogging.Comments { } - public async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) + public virtual async Task> GetListOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Where(a => a.PostId == postId) @@ -24,19 +24,19 @@ namespace Volo.Blogging.Comments .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) + public virtual async Task GetCommentCountOfPostAsync(Guid postId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .CountAsync(a => a.PostId == postId, GetCancellationToken(cancellationToken)); } - public async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) + public virtual async Task> GetRepliesOfComment(Guid id, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Where(a => a.RepliedCommentId == id).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) + public virtual async Task DeleteOfPost(Guid id, CancellationToken cancellationToken = default) { var recordsToDelete = (await GetMongoQueryableAsync(cancellationToken)).Where(pt => pt.PostId == id); diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs index eea6e82015..3cdcccc5fd 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Posts/MongoPostRepository.cs @@ -18,13 +18,13 @@ namespace Volo.Blogging.Posts { } - public async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) + public virtual async Task> GetPostsByBlogId(Guid id, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(p => p.BlogId == id).OrderByDescending(p => p.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) + public virtual async Task IsPostUrlInUseAsync(Guid blogId, string url, Guid? excludingPostId = null, CancellationToken cancellationToken = default) { var query = (await GetMongoQueryableAsync(cancellationToken)).Where(p => blogId == p.BlogId && p.Url == url); @@ -36,7 +36,7 @@ namespace Volo.Blogging.Posts return await query.AnyAsync(GetCancellationToken(cancellationToken)); } - public async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) + public virtual async Task GetPostByUrl(Guid blogId, string url, CancellationToken cancellationToken = default) { var post = await (await GetMongoQueryableAsync(cancellationToken)).FirstOrDefaultAsync(p => p.BlogId == blogId && p.Url == url, GetCancellationToken(cancellationToken)); @@ -48,7 +48,7 @@ namespace Volo.Blogging.Posts return post; } - public async Task> GetOrderedList(Guid blogId, bool @descending = false, CancellationToken cancellationToken = default) + public virtual async Task> GetOrderedList(Guid blogId, bool @descending = false, CancellationToken cancellationToken = default) { var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.BlogId == blogId); @@ -60,7 +60,7 @@ namespace Volo.Blogging.Posts return await query.OrderByDescending(x => x.CreationTime).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default) + public virtual async Task> GetListByUserIdAsync(Guid userId, CancellationToken cancellationToken = default) { var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.CreatorId == userId) .OrderByDescending(x => x.CreationTime); @@ -68,7 +68,7 @@ namespace Volo.Blogging.Posts return await query.ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) + public virtual async Task> GetLatestBlogPostsAsync(Guid blogId, int count, CancellationToken cancellationToken = default) { var query = (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.BlogId == blogId) .OrderByDescending(x => x.CreationTime) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs index 2030d47f2d..bfa0c9fb4d 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Tagging/MongoTagRepository.cs @@ -18,27 +18,27 @@ namespace Volo.Blogging.Tagging { } - public async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) + public virtual async Task GetByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId && t.Name == name).FirstAsync(GetCancellationToken(cancellationToken)); } - public async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(Guid blogId, string name, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => t.BlogId == blogId && t.Name == name).FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(IEnumerable ids, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(t => ids.Contains(t.Id)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) + public virtual async Task DecreaseUsageCountOfTagsAsync(List ids, CancellationToken cancellationToken = default) { var tags = await (await GetMongoQueryableAsync(cancellationToken)) .Where(t => ids.Contains(t.Id)) diff --git a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs index 5523af8394..3595620f54 100644 --- a/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs +++ b/modules/blogging/src/Volo.Blogging.MongoDB/Volo/Blogging/Users/MongoBlogUserRepository.cs @@ -15,7 +15,7 @@ namespace Volo.Blogging.Users { } - public async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetUsersAsync(int maxCount, string filter, CancellationToken cancellationToken = default) { var query = await GetMongoQueryableAsync(cancellationToken); diff --git a/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/CommentsController.cs b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/CommentsController.cs index 26be2a914f..116ace0c0b 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/CommentsController.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/CommentsController.cs @@ -22,13 +22,13 @@ namespace Volo.Blogging.Areas.Blog.Controllers } [HttpPost] - public async Task Delete(Guid id) + public virtual async Task Delete(Guid id) { await _commentAppService.DeleteAsync(id); } [HttpPost] - public async Task Update(Guid id, UpdateCommentDto commentDto) + public virtual async Task Update(Guid id, UpdateCommentDto commentDto) { await _commentAppService.UpdateAsync(id, commentDto); } diff --git a/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/PostsController.cs b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/PostsController.cs index 406196a5f2..1065ef2554 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/PostsController.cs @@ -20,7 +20,7 @@ namespace Volo.Blogging.Areas.Blog.Controllers } [HttpPost] - public async Task Delete(Guid id) + public virtual async Task Delete(Guid id) { await _postAppService.DeleteAsync(id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs index f396e3edd5..1bf9775d30 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Blogs/BlogPostAdminAppService.cs @@ -177,7 +177,7 @@ public class BlogPostAdminAppService : CmsKitAppServiceBase, IBlogPostAdminAppSe } [Authorize(CmsKitAdminPermissions.BlogPosts.Publish)] - public async Task HasBlogPostWaitingForReviewAsync() + public virtual async Task HasBlogPostWaitingForReviewAsync() { return await BlogPostRepository.HasBlogPostWaitingForReviewAsync(); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/GlobalResources/GlobalResourceAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/GlobalResources/GlobalResourceAdminAppService.cs index c5b63db6c3..0847347ab6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/GlobalResources/GlobalResourceAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/GlobalResources/GlobalResourceAdminAppService.cs @@ -22,7 +22,7 @@ public class GlobalResourceAdminAppService : ApplicationService, IGlobalResource GlobalResourceManager = globalResourceManager; } - public async Task GetAsync() + public virtual async Task GetAsync() { return new GlobalResourcesDto { @@ -31,7 +31,7 @@ public class GlobalResourceAdminAppService : ApplicationService, IGlobalResource }; } - public async Task SetGlobalResourcesAsync(GlobalResourcesUpdateDto input) + public virtual async Task SetGlobalResourcesAsync(GlobalResourcesUpdateDto input) { await GlobalResourceManager.SetGlobalStyleAsync(input.Style); await GlobalResourceManager.SetGlobalScriptAsync(input.Script); diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs index d856fa8511..b30a2308e1 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.Application/Volo/CmsKit/Admin/Tags/TagAdminAppService.cs @@ -39,7 +39,7 @@ public class TagAdminAppService : CmsKitAppServiceBase, ITagAdminAppService } [Authorize(CmsKitAdminPermissions.Tags.Create)] - public async Task CreateAsync(TagCreateDto input) + public virtual async Task CreateAsync(TagCreateDto input) { var tag = await TagManager.CreateAsync( GuidGenerator.Create(), @@ -52,7 +52,7 @@ public class TagAdminAppService : CmsKitAppServiceBase, ITagAdminAppService } [Authorize(CmsKitAdminPermissions.Tags.Update)] - public async Task UpdateAsync(Guid id, TagUpdateDto input) + public virtual async Task UpdateAsync(Guid id, TagUpdateDto input) { var tag = await TagManager.UpdateAsync( id, @@ -82,7 +82,7 @@ public class TagAdminAppService : CmsKitAppServiceBase, ITagAdminAppService } [Authorize(CmsKitAdminPermissions.Tags.Default)] - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { var tag = await Repository.GetAsync(id); @@ -90,7 +90,7 @@ public class TagAdminAppService : CmsKitAppServiceBase, ITagAdminAppService } [Authorize(CmsKitAdminPermissions.Tags.Default)] - public async Task> GetListAsync(TagGetListInput input) + public virtual async Task> GetListAsync(TagGetListInput input) { var tags = await Repository.GetListAsync(input.Filter); var count = await Repository.GetCountAsync(input.Filter); @@ -102,7 +102,7 @@ public class TagAdminAppService : CmsKitAppServiceBase, ITagAdminAppService } [Authorize(CmsKitAdminPermissions.Tags.Delete)] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { await Repository.DeleteAsync(id); } diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogFeatureRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogFeatureRepository.cs index 80c093ccb4..8b27b91b59 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogFeatureRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogFeatureRepository.cs @@ -21,14 +21,14 @@ public class EfCoreBlogFeatureRepository : EfCoreRepository x.BlogId == blogId && x.FeatureName == featureName, cancellationToken: cancellationToken); } - public async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid blogId, CancellationToken cancellationToken = default) { return await (await GetQueryableAsync()) .Where(x => x.BlogId == blogId) .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(Guid blogId, List featureNames, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid blogId, List featureNames, CancellationToken cancellationToken = default) { return await (await GetQueryableAsync()) .Where(x => x.BlogId == blogId && featureNames.Contains(x.FeatureName)) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs index 70ce3197e6..266a04a910 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Blogs/EfCoreBlogPostRepository.cs @@ -27,7 +27,7 @@ public class EfCoreBlogPostRepository : EfCoreRepository GetBySlugAsync( + public virtual async Task GetBySlugAsync( Guid blogId, [NotNull] string slug, CancellationToken cancellationToken = default) @@ -118,7 +118,7 @@ public class EfCoreBlogPostRepository : EfCoreRepository SlugExistsAsync(Guid blogId, [NotNull] string slug, + public virtual async Task SlugExistsAsync(Guid blogId, [NotNull] string slug, CancellationToken cancellationToken = default) { Check.NotNullOrEmpty(slug, nameof(slug)); @@ -127,7 +127,7 @@ public class EfCoreBlogPostRepository : EfCoreRepository> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) { return await (await CreateAuthorsQueryableAsync()) .Skip(skipCount) @@ -137,14 +137,14 @@ public class EfCoreBlogPostRepository : EfCoreRepository GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) { return await (await CreateAuthorsQueryableAsync()) .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower())) .CountAsync(GetCancellationToken(cancellationToken)); } - public async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) { return await (await CreateAuthorsQueryableAsync()).FirstOrDefaultAsync(x => x.Id == id, GetCancellationToken(cancellationToken)) ?? throw new EntityNotFoundException(typeof(CmsUser), id); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs index 44d5000c8a..3102bcc40b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Comments/EfCoreCommentRepository.cs @@ -22,7 +22,7 @@ public class EfCoreCommentRepository : EfCoreRepository GetWithAuthorAsync(Guid id, + public virtual async Task GetWithAuthorAsync(Guid id, CancellationToken cancellationToken = default) { var query = from comment in (await GetDbSetAsync()) @@ -44,7 +44,7 @@ public class EfCoreCommentRepository : EfCoreRepository> GetListAsync( + public virtual async Task> GetListAsync( string filter = null, string entityType = null, Guid? repliedCommentId = null, @@ -78,7 +78,7 @@ public class EfCoreCommentRepository : EfCoreRepository GetCountAsync( + public virtual async Task GetCountAsync( string text = null, string entityType = null, Guid? repliedCommentId = null, @@ -101,7 +101,7 @@ public class EfCoreCommentRepository : EfCoreRepository> GetListWithAuthorsAsync( + public virtual async Task> GetListWithAuthorsAsync( string entityType, string entityId, CancellationToken cancellationToken = default) @@ -122,7 +122,7 @@ public class EfCoreCommentRepository : EfCoreRepository GetCurrentUserRatingAsync(string entityType, string entityId, Guid userId, + public virtual async Task GetCurrentUserRatingAsync(string entityType, string entityId, Guid userId, CancellationToken cancellationToken = default) { Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); @@ -31,7 +31,7 @@ public class EfCoreRatingRepository : EfCoreRepository> GetGroupedStarCountsAsync(string entityType, + public virtual async Task> GetGroupedStarCountsAsync(string entityType, string entityId, CancellationToken cancellationToken = default) { Check.NotNullOrWhiteSpace(entityType, nameof(entityType)); diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs index 522350dfd3..f7582e78a4 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Reactions/EfCoreUserReactionRepository.cs @@ -19,7 +19,7 @@ public class EfCoreUserReactionRepository : EfCoreRepository FindAsync( + public virtual async Task FindAsync( Guid userId, string entityType, string entityId, @@ -39,7 +39,7 @@ public class EfCoreUserReactionRepository : EfCoreRepository> GetListForUserAsync( + public virtual async Task> GetListForUserAsync( Guid userId, string entityType, string entityId, @@ -56,7 +56,7 @@ public class EfCoreUserReactionRepository : EfCoreRepository> GetSummariesAsync( + public virtual async Task> GetSummariesAsync( string entityType, string entityId, CancellationToken cancellationToken = default) diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs index 8dfeacfc36..a1a5da42a6 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreEntityTagRepository.cs @@ -53,7 +53,7 @@ public class EfCoreEntityTagRepository : EfCoreRepository> GetEntityIdsFilteredByTagNameAsync( + public virtual async Task> GetEntityIdsFilteredByTagNameAsync( [NotNull] string tagName, [NotNull] string entityType, [CanBeNull] Guid? tenantId = null, diff --git a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs index 9b750eaac5..95c33a4d3f 100644 --- a/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.EntityFrameworkCore/Volo/CmsKit/Tags/EfCoreTagRepository.cs @@ -80,12 +80,12 @@ public class EfCoreTagRepository : EfCoreRepository return await query.ToListAsync(cancellationToken: GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(string filter, CancellationToken cancellationToken = default) { return await (await GetQueryableByFilterAsync(filter)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter, CancellationToken cancellationToken = default) { return await (await GetQueryableByFilterAsync(filter)).CountAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs index 9358635f5c..785ce2ec73 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Blogs/MongoBlogPostRepository.cs @@ -128,7 +128,7 @@ public class MongoBlogPostRepository : MongoDbRepository x.BlogId == blogId && x.Slug.ToLower() == slug, cancellationToken); } - public async Task> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetAuthorsHasBlogPostsAsync(int skipCount, int maxResultCount, string sorting, string filter, CancellationToken cancellationToken = default) { var queryable = (await CreateAuthorsQueryableAsync(cancellationToken)) .Skip(skipCount) @@ -139,14 +139,14 @@ public class MongoBlogPostRepository : MongoDbRepository GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task GetAuthorsHasBlogPostsCountAsync(string filter, CancellationToken cancellationToken = default) { return await AsyncExecuter.CountAsync( (await CreateAuthorsQueryableAsync(cancellationToken)) .WhereIf(!filter.IsNullOrEmpty(), x => x.UserName.Contains(filter.ToLower()))); } - public async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task GetAuthorHasBlogPostAsync(Guid id, CancellationToken cancellationToken = default) { return await AsyncExecuter.FirstOrDefaultAsync(await CreateAuthorsQueryableAsync(cancellationToken), x => x.Id == id) ?? throw new EntityNotFoundException(typeof(CmsUser), id); diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs index b270255900..2e8dc96d01 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoEntityTagRepository.cs @@ -60,7 +60,7 @@ public class MongoEntityTagRepository : MongoDbRepository> GetEntityIdsFilteredByTagNameAsync( + public virtual async Task> GetEntityIdsFilteredByTagNameAsync( [NotNull] string tagName, [NotNull] string entityType, [CanBeNull] Guid? tenantId = null, diff --git a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs index f8bedebf61..33cdcd18bc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs +++ b/modules/cms-kit/src/Volo.CmsKit.MongoDB/Volo/CmsKit/MongoDB/Tags/MongoTagRepository.cs @@ -19,7 +19,7 @@ public class MongoTagRepository : MongoDbRepository AnyAsync( + public virtual async Task AnyAsync( [NotNull] string entityType, [NotNull] string name, CancellationToken cancellationToken = default) @@ -82,12 +82,12 @@ public class MongoTagRepository : MongoDbRepository> GetListAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(string filter, CancellationToken cancellationToken = default) { return await (await GetQueryableByFilterAsync(filter, cancellationToken)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetCountAsync(string filter, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter, CancellationToken cancellationToken = default) { return await (await GetQueryableByFilterAsync(filter, cancellationToken)).CountAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs index 91b7936251..cd346f9a21 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Blogs/BlogPostPublicAppService.cs @@ -66,7 +66,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub authorDtos); } - public async Task GetAuthorHasBlogPostAsync(Guid id) + public virtual async Task GetAuthorHasBlogPostAsync(Guid id) { var author = await BlogPostRepository.GetAuthorHasBlogPostAsync(id); @@ -74,7 +74,7 @@ public class BlogPostPublicAppService : CmsKitPublicAppServiceBase, IBlogPostPub } [Authorize] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { var rating = await BlogPostRepository.GetAsync(id); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/GlobalResourcePublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/GlobalResourcePublicAppService.cs index af0d1fbf39..3b432967db 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/GlobalResourcePublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/GlobalResources/GlobalResourcePublicAppService.cs @@ -19,14 +19,14 @@ public class GlobalResourcePublicAppService : ApplicationService, IGlobalResourc GlobalResourceManager = globalResourceManager; } - public async Task GetGlobalScriptAsync() + public virtual async Task GetGlobalScriptAsync() { var globalScript = await GlobalResourceManager.GetGlobalScriptAsync(); return ObjectMapper.Map(globalScript); } - public async Task GetGlobalStyleAsync() + public virtual async Task GetGlobalStyleAsync() { var globalStyle = await GlobalResourceManager.GetGlobalStyleAsync(); diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Menus/MenuItemPublicAppService.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Menus/MenuItemPublicAppService.cs index 0e9062d9af..571ed7749d 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Menus/MenuItemPublicAppService.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Application/Volo/CmsKit/Public/Menus/MenuItemPublicAppService.cs @@ -24,7 +24,7 @@ public class MenuItemPublicAppService : CmsKitPublicAppServiceBase, IMenuItemPub DistributedCache = distributedCache; } - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { var cachedMenu = await DistributedCache.GetOrAddAsync( MenuApplicationConsts.MainMenuCacheKey, diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicCommentsController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicCommentsController.cs index e10a606826..00851bce15 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicCommentsController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicCommentsController.cs @@ -29,7 +29,7 @@ public class CmsKitPublicCommentsController : AbpController } [HttpPost] - public async Task ValidateAsync([FromBody] CreateCommentWithParametersInput input) + public virtual async Task ValidateAsync([FromBody] CreateCommentWithParametersInput input) { if (CmsKitCommentOptions.IsRecaptchaEnabled && input.CaptchaToken.HasValue) { diff --git a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicGlobalResourcesController.cs b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicGlobalResourcesController.cs index c709904527..115dfd3fcc 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicGlobalResourcesController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Public.Web/Controllers/CmsKitPublicGlobalResourcesController.cs @@ -26,7 +26,7 @@ public class CmsKitPublicGlobalResourcesController: AbpController [HttpGet] [Route("style")] - public async Task GetGlobalStyleAsync() + public virtual async Task GetGlobalStyleAsync() { var style = await _resourceCache.GetOrAddAsync( GlobalResourceConsts.GlobalStyleName, //Cache key @@ -44,7 +44,7 @@ public class CmsKitPublicGlobalResourcesController: AbpController [HttpGet] [Route("script")] - public async Task GetGlobalScriptAsync() + public virtual async Task GetGlobalScriptAsync() { var script = await _resourceCache.GetOrAddAsync( GlobalResourceConsts.GlobalScriptName, //Cache key diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs index 7d68681b1d..3b777ece48 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Documents/DocumentAdminAppService.cs @@ -47,7 +47,7 @@ namespace Volo.Docs.Admin.Documents LocalizationResource = typeof(DocsResource); } - public async Task ClearCacheAsync(ClearCacheInput input) + public virtual async Task ClearCacheAsync(ClearCacheInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); @@ -75,7 +75,7 @@ namespace Volo.Docs.Admin.Documents } } - public async Task PullAllAsync(PullAllDocumentInput input) + public virtual async Task PullAllAsync(PullAllDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); @@ -129,7 +129,7 @@ namespace Volo.Docs.Admin.Documents } } - public async Task PullAsync(PullDocumentInput input) + public virtual async Task PullAsync(PullDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); @@ -142,7 +142,7 @@ namespace Volo.Docs.Admin.Documents await UpdateDocumentUpdateInfoCache(sourceDocument); } - public async Task> GetAllAsync(GetAllInput input) + public virtual async Task> GetAllAsync(GetAllInput input) { var totalCount = await _documentRepository.GetAllCountAsync( projectId: input.ProjectId, @@ -191,7 +191,7 @@ namespace Volo.Docs.Admin.Documents }; } - public async Task RemoveFromCacheAsync(Guid documentId) + public virtual async Task RemoveFromCacheAsync(Guid documentId) { var document = await _documentRepository.GetAsync(documentId); var project = await _projectRepository.GetAsync(document.ProjectId); @@ -207,7 +207,7 @@ namespace Volo.Docs.Admin.Documents await _documentRepository.DeleteAsync(document); } - public async Task ReindexAsync(Guid documentId) + public virtual async Task ReindexAsync(Guid documentId) { _elasticSearchService.ValidateElasticSearchEnabled(); @@ -216,7 +216,7 @@ namespace Volo.Docs.Admin.Documents await _elasticSearchService.AddOrUpdateAsync(document); } - public async Task> GetFilterItemsAsync() + public virtual async Task> GetFilterItemsAsync() { var documents = await _documentRepository.GetUniqueListDocumentInfoAsync(); return ObjectMapper.Map, List>(documents); diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs index 540ecfe275..f82f578da5 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/Projects/ProjectAdminAppService.cs @@ -37,7 +37,7 @@ namespace Volo.Docs.Admin.Projects _guidGenerator = guidGenerator; } - public async Task> GetListAsync(PagedAndSortedResultRequestDto input) + public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) { var projects = await _projectRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); @@ -49,7 +49,7 @@ namespace Volo.Docs.Admin.Projects ); } - public async Task GetAsync(Guid id) + public virtual async Task GetAsync(Guid id) { var project = await _projectRepository.GetAsync(id); @@ -57,7 +57,7 @@ namespace Volo.Docs.Admin.Projects } [Authorize(DocsAdminPermissions.Projects.Create)] - public async Task CreateAsync(CreateProjectDto input) + public virtual async Task CreateAsync(CreateProjectDto input) { if (await _projectRepository.ShortNameExistsAsync(input.ShortName)) { @@ -90,7 +90,7 @@ namespace Volo.Docs.Admin.Projects } [Authorize(DocsAdminPermissions.Projects.Update)] - public async Task UpdateAsync(Guid id, UpdateProjectDto input) + public virtual async Task UpdateAsync(Guid id, UpdateProjectDto input) { var project = await _projectRepository.GetAsync(id); @@ -115,12 +115,12 @@ namespace Volo.Docs.Admin.Projects } [Authorize(DocsAdminPermissions.Projects.Delete)] - public async Task DeleteAsync(Guid id) + public virtual async Task DeleteAsync(Guid id) { await _projectRepository.DeleteAsync(id); } - public async Task ReindexAsync(ReindexInput input) + public virtual async Task ReindexAsync(ReindexInput input) { _elasticSearchService.ValidateElasticSearchEnabled(); @@ -146,7 +146,7 @@ namespace Volo.Docs.Admin.Projects } } - public async Task ReindexAllAsync() + public virtual async Task ReindexAllAsync() { _elasticSearchService.ValidateElasticSearchEnabled(); var projects = await _projectRepository.GetListAsync(); @@ -157,7 +157,7 @@ namespace Volo.Docs.Admin.Projects } } - public async Task> GetListWithoutDetailsAsync() + public virtual async Task> GetListWithoutDetailsAsync() { var projects = await _projectRepository.GetListWithoutDetailsAsync(); return ObjectMapper.Map, List>(projects); diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs index c0586ed699..bbb12f34db 100644 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/DocumentsAdminController.cs @@ -52,21 +52,21 @@ namespace Volo.Docs.Admin [HttpPut] [Route("RemoveDocumentFromCache")] - public async Task RemoveFromCacheAsync(Guid documentId) + public virtual async Task RemoveFromCacheAsync(Guid documentId) { await _documentAdminAppService.RemoveFromCacheAsync(documentId); } [HttpPut] [Route("ReindexDocument")] - public async Task ReindexAsync(Guid documentId) + public virtual async Task ReindexAsync(Guid documentId) { await _documentAdminAppService.ReindexAsync(documentId); } [HttpGet] [Route("GetFilterItems")] - public async Task> GetFilterItemsAsync() + public virtual async Task> GetFilterItemsAsync() { return await _documentAdminAppService.GetFilterItemsAsync(); } diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs index 228648f2fb..e3ee400951 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Documents/DocumentAppService.cs @@ -141,7 +141,7 @@ namespace Volo.Docs.Documents return navigationNode; } - public async Task GetResourceAsync(GetDocumentResourceInput input) + public virtual async Task GetResourceAsync(GetDocumentResourceInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); @@ -176,7 +176,7 @@ namespace Volo.Docs.Documents ); } - public async Task> SearchAsync(DocumentSearchInput input) + public virtual async Task> SearchAsync(DocumentSearchInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); @@ -197,12 +197,12 @@ namespace Volo.Docs.Documents .ToList(); } - public async Task FullSearchEnabledAsync() + public virtual async Task FullSearchEnabledAsync() { return await Task.FromResult(_docsElasticSearchOptions.Enable); } - public async Task> GetUrlsAsync(string prefix) + public virtual async Task> GetUrlsAsync(string prefix) { var documentUrls = new List(); var projects = await _projectRepository.GetListAsync(); @@ -321,7 +321,7 @@ namespace Volo.Docs.Documents path.StartsWith("https://", StringComparison.OrdinalIgnoreCase); } - public async Task GetParametersAsync(GetParametersDocumentInput input) + public virtual async Task GetParametersAsync(GetParametersDocumentInput input) { var project = await _projectRepository.GetAsync(input.ProjectId); diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs index af39991783..869a0efa82 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/Projects/ProjectAppService.cs @@ -31,7 +31,7 @@ namespace Volo.Docs.Projects LanguageCache = languageCache; } - public async Task> GetListAsync() + public virtual async Task> GetListAsync() { var projects = await _projectRepository.GetListAsync(); @@ -44,7 +44,7 @@ namespace Volo.Docs.Projects ); } - public async Task GetAsync(string shortName) + public virtual async Task GetAsync(string shortName) { var project = await _projectRepository.GetByShortNameAsync(shortName); @@ -53,7 +53,7 @@ namespace Volo.Docs.Projects return HidePrivateProperties(projectDto); } - public async Task> GetVersionsAsync(string shortName) + public virtual async Task> GetVersionsAsync(string shortName) { var project = await _projectRepository.GetByShortNameAsync(shortName); @@ -95,12 +95,12 @@ namespace Volo.Docs.Projects return versions; } - public async Task GetLanguageListAsync(string shortName, string version) + public virtual async Task GetLanguageListAsync(string shortName, string version) { return await GetLanguageListInternalAsync(shortName, version); } - public async Task GetDefaultLanguageCodeAsync(string shortName, string version) + public virtual async Task GetDefaultLanguageCodeAsync(string shortName, string version) { var languageList = await GetLanguageListInternalAsync(shortName, version); diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs index d90b74a20f..700203e7dd 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Documents/EFCoreDocumentRepository.cs @@ -18,7 +18,7 @@ namespace Volo.Docs.Documents { } - public async Task> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) + public virtual async Task> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Where(d => d.ProjectId == projectId) @@ -32,7 +32,7 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -49,13 +49,13 @@ namespace Volo.Docs.Documents } - public async Task> GetListByProjectId(Guid projectId, + public virtual async Task> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).Where(d => d.ProjectId == projectId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(version != null, x => x.Version == version) @@ -64,7 +64,7 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetAllAsync( + public virtual async Task> GetAllAsync( Guid? projectId, string name, string version, @@ -104,7 +104,7 @@ namespace Volo.Docs.Documents return await query.PageBy(skipCount, maxResultCount).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetAllCountAsync( + public virtual async Task GetAllCountAsync( Guid? projectId, string name, string version, @@ -143,7 +143,7 @@ namespace Volo.Docs.Documents return await query.LongCountAsync(GetCancellationToken(cancellationToken)); } - public async Task FindAsync(Guid projectId, string name, string languageCode, string version, + public virtual async Task FindAsync(Guid projectId, string name, string languageCode, string version, bool includeDetails = true, CancellationToken cancellationToken = default) { @@ -154,14 +154,14 @@ namespace Volo.Docs.Documents GetCancellationToken(cancellationToken)); } - public async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) { await DeleteAsync(x => x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && x.Version == version, autoSave, cancellationToken: cancellationToken); } - public async Task GetAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task GetAsync(Guid id, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).Where(x => x.Id == id).SingleAsync(cancellationToken: GetCancellationToken(cancellationToken)); } diff --git a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs index f08e4b77af..cbdf4cec06 100644 --- a/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs +++ b/modules/docs/src/Volo.Docs.EntityFrameworkCore/Volo/Docs/Projects/EfCoreProjectRepository.cs @@ -19,7 +19,7 @@ namespace Volo.Docs.Projects { } - public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) { var projects = await (await GetDbSetAsync()).OrderBy(sorting.IsNullOrEmpty() ? "Id desc" : sorting) .PageBy(skipCount, maxResultCount) @@ -28,7 +28,7 @@ namespace Volo.Docs.Projects return projects; } - public async Task> GetListWithoutDetailsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetListWithoutDetailsAsync(CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .Select(x=> new ProjectWithoutDetails() { @@ -39,7 +39,7 @@ namespace Volo.Docs.Projects .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); @@ -53,7 +53,7 @@ namespace Volo.Docs.Projects return project; } - public async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs index 75e1fe9276..1cd93545a5 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Documents/MongoDocumentRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Docs.Documents { } - public async Task> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) + public virtual async Task> GetListWithoutDetailsByProjectId(Guid projectId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Where(d => d.ProjectId == projectId) @@ -34,7 +34,7 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetUniqueListDocumentInfoAsync(CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Select(x=> new DocumentInfo { @@ -48,12 +48,12 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default) + public virtual async Task> GetListByProjectId(Guid projectId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(d => d.ProjectId == projectId).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task FindAsync(Guid projectId, string name, string languageCode, string version, + public virtual async Task FindAsync(Guid projectId, string name, string languageCode, string version, bool includeDetails = true, CancellationToken cancellationToken = default) { @@ -63,14 +63,14 @@ namespace Volo.Docs.Documents x.Version == version, GetCancellationToken(cancellationToken)); } - public async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(Guid projectId, string name, string languageCode, string version, bool autoSave = false, CancellationToken cancellationToken = default) { await DeleteAsync(x => x.ProjectId == projectId && x.Name == name && x.LanguageCode == languageCode && x.Version == version, autoSave, cancellationToken: cancellationToken); } - public async Task> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid? projectId, string version, string name, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf(version != null, x => x.Version == version) @@ -80,7 +80,7 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> GetAllAsync( + public virtual async Task> GetAllAsync( Guid? projectId, string name, string version, @@ -122,7 +122,7 @@ namespace Volo.Docs.Documents .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetAllCountAsync( + public virtual async Task GetAllCountAsync( Guid? projectId, string name, string version, @@ -165,7 +165,7 @@ namespace Volo.Docs.Documents .LongCountAsync(GetCancellationToken(cancellationToken)); } - public async Task GetAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task GetAsync(Guid id, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.Id == id).SingleAsync(GetCancellationToken(cancellationToken)); } diff --git a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs index 0562452a2f..3960b07eb3 100644 --- a/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs +++ b/modules/docs/src/Volo.Docs.MongoDB/Volo/Docs/Projects/MongoProjectRepository.cs @@ -20,7 +20,7 @@ namespace Volo.Docs.Projects { } - public async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(string sorting, int maxResultCount, int skipCount, CancellationToken cancellationToken = default) { var projects = await (await GetMongoQueryableAsync(cancellationToken)).OrderBy(sorting.IsNullOrEmpty() ? "Id desc" : sorting).As>() .PageBy>(skipCount, maxResultCount) @@ -29,7 +29,7 @@ namespace Volo.Docs.Projects return projects; } - public async Task> GetListWithoutDetailsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetListWithoutDetailsAsync(CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Select(x=> new ProjectWithoutDetails { @@ -40,7 +40,7 @@ namespace Volo.Docs.Projects .ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task GetByShortNameAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); @@ -54,7 +54,7 @@ namespace Volo.Docs.Projects return project; } - public async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) + public virtual async Task ShortNameExistsAsync(string shortName, CancellationToken cancellationToken = default) { var normalizeShortName = NormalizeShortName(shortName); diff --git a/modules/docs/src/Volo.Docs.Web/Areas/Documents/DocumentResourceController.cs b/modules/docs/src/Volo.Docs.Web/Areas/Documents/DocumentResourceController.cs index 0f444a0172..7b2099a27c 100644 --- a/modules/docs/src/Volo.Docs.Web/Areas/Documents/DocumentResourceController.cs +++ b/modules/docs/src/Volo.Docs.Web/Areas/Documents/DocumentResourceController.cs @@ -24,7 +24,7 @@ namespace Volo.Docs.Areas.Documents [HttpGet] [Route("")] - public async Task GetResource(GetDocumentResourceInput input) + public virtual async Task GetResource(GetDocumentResourceInput input) { input.Name = input.Name.RemovePreFix("/"); var documentResource = await _documentAppService.GetResourceAsync(input); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs index 233ce31edf..555682d56d 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.EntityFrameworkCore/Volo/Abp/FeatureManagement/EntityFrameworkCore/EfCoreFeatureValueRepository.cs @@ -28,7 +28,7 @@ public class EfCoreFeatureValueRepository : EfCoreRepository s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken)); } - public async Task> FindAllAsync( + public virtual async Task> FindAllAsync( string name, string providerName, string providerKey, @@ -51,7 +51,7 @@ public class EfCoreFeatureValueRepository : EfCoreRepository s.Name == name && s.ProviderName == providerName && s.ProviderKey == providerKey, GetCancellationToken(cancellationToken)); } - public async Task> FindAllAsync( + public virtual async Task> FindAllAsync( string name, string providerName, string providerKey, diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs index a0594949b6..4695517810 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserLookupAppService.cs @@ -40,7 +40,7 @@ public class IdentityUserLookupAppService : IdentityAppServiceBase, IIdentityUse return new UserData(userData); } - public async Task> SearchAsync(UserLookupSearchInputDto input) + public virtual async Task> SearchAsync(UserLookupSearchInputDto input) { var users = await UserLookupServiceProvider.SearchAsync( input.Sorting, @@ -56,7 +56,7 @@ public class IdentityUserLookupAppService : IdentityAppServiceBase, IIdentityUse ); } - public async Task GetCountAsync(UserLookupCountInputDto input) + public virtual async Task GetCountAsync(UserLookupCountInputDto input) { return await UserLookupServiceProvider.GetCountAsync(input.Filter); } diff --git a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserDelegationRepository.cs b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserDelegationRepository.cs index cd567ffa80..a21e0f8ea0 100644 --- a/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserDelegationRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.EntityFrameworkCore/Volo/Abp/Identity/EntityFrameworkCore/EfCoreIdentityUserDelegationRepository.cs @@ -20,7 +20,7 @@ public class EfCoreIdentityUserDelegationRepository : EfCoreRepository> GetListAsync(Guid? sourceUserId, Guid? targetUserId, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(Guid? sourceUserId, Guid? targetUserId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .AsNoTracking() @@ -29,7 +29,7 @@ public class EfCoreIdentityUserDelegationRepository : EfCoreRepository> GetActiveDelegationsAsync(Guid targetUserId, CancellationToken cancellationToken = default) + public virtual async Task> GetActiveDelegationsAsync(Guid targetUserId, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .AsNoTracking() @@ -39,7 +39,7 @@ public class EfCoreIdentityUserDelegationRepository : EfCoreRepository FindActiveDelegationByIdAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task FindActiveDelegationByIdAsync(Guid id, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .AsNoTracking() diff --git a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserDelegationRepository.cs b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserDelegationRepository.cs index a782dd57c9..56cc48121e 100644 --- a/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserDelegationRepository.cs +++ b/modules/identity/src/Volo.Abp.Identity.MongoDB/Volo/Abp/Identity/MongoDB/MongoIdentityUserDelegationRepository.cs @@ -21,7 +21,7 @@ public class MongoIdentityUserDelegationRepository : MongoDbRepository> GetListAsync(Guid? sourceUserId, Guid? targetUserId, + public virtual async Task> GetListAsync(Guid? sourceUserId, Guid? targetUserId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -31,7 +31,7 @@ public class MongoIdentityUserDelegationRepository : MongoDbRepository> GetActiveDelegationsAsync(Guid targetUserId, CancellationToken cancellationToken = default) + public virtual async Task> GetActiveDelegationsAsync(Guid targetUserId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .Where(x => x.TargetUserId == targetUserId) @@ -40,7 +40,7 @@ public class MongoIdentityUserDelegationRepository : MongoDbRepository FindActiveDelegationByIdAsync(Guid id, CancellationToken cancellationToken = default) + public virtual async Task FindActiveDelegationByIdAsync(Guid id, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .FirstOrDefaultAsync(x => diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs index d754521bdc..08a9c43ed3 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiResources/ApiResourceRepository.cs @@ -18,7 +18,7 @@ public class ApiResourceRepository : EfCoreRepository FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) @@ -26,7 +26,7 @@ public class ApiResourceRepository : EfCoreRepository apiResource.Name == apiResourceName, GetCancellationToken(cancellationToken)); } - public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, + public virtual async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -64,7 +64,7 @@ public class ApiResourceRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs index dde660054d..b1f0a8cece 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/ApiScopes/ApiScopeRepository.cs @@ -18,7 +18,7 @@ public class ApiScopeRepository : EfCoreRepository FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) @@ -26,7 +26,7 @@ public class ApiScopeRepository : EfCoreRepository x.Name == scopeName, GetCancellationToken(cancellationToken)); } - public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, + public virtual async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -36,7 +36,7 @@ public class ApiScopeRepository : EfCoreRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .IncludeDetails(includeDetails) @@ -48,7 +48,7 @@ public class ApiScopeRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), @@ -58,7 +58,7 @@ public class ApiScopeRepository : EfCoreRepository CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) + public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()).AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs index 5f0c3ba676..8edaad0345 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Clients/ClientRepository.cs @@ -41,7 +41,7 @@ public class ClientRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistentGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistentGrantRepository.cs index 394b9c58ec..68317cd94d 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistentGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/Grants/PersistentGrantRepository.cs @@ -18,7 +18,7 @@ public class PersistentGrantRepository : EfCoreRepository> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, + public virtual async Task> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await FilterAsync(subjectId, sessionId, clientId, type)) @@ -60,7 +60,7 @@ public class PersistentGrantRepository : EfCoreRepository x.Expiration != null && x.Expiration < maxExpirationDate, cancellationToken); } - public async Task DeleteAsync( + public virtual async Task DeleteAsync( string subjectId = null, string sessionId = null, string clientId = null, diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs index 425a32f970..604c02fe54 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.EntityFrameworkCore/Volo/Abp/IdentityServer/IdentityResources/IdentityResourceRepository.cs @@ -54,7 +54,7 @@ public class IdentityResourceRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs index af0f63ae0f..24dc519a40 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiResourceRepository.cs @@ -18,14 +18,14 @@ public class MongoApiResourceRepository : MongoDbRepository FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(string apiResourceName, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(ar => ar.Id) .FirstOrDefaultAsync(ar => ar.Name == apiResourceName, GetCancellationToken(cancellationToken)); } - public async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, + public virtual async Task> FindByNameAsync(string[] apiResourceNames, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -55,7 +55,7 @@ public class MongoApiResourceRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf>(!filter.IsNullOrWhiteSpace(), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs index eddd300909..01c1ecad07 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoApiScopeRepository.cs @@ -20,14 +20,14 @@ public class MongoApiScopeRepository : MongoDbRepository FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default) + public virtual async Task FindByNameAsync(string scopeName, bool includeDetails = true, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id) .FirstOrDefaultAsync(x => x.Name == scopeName, GetCancellationToken(cancellationToken)); } - public async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, + public virtual async Task> GetListByNameAsync(string[] scopeNames, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -36,7 +36,7 @@ public class MongoApiScopeRepository : MongoDbRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -50,7 +50,7 @@ public class MongoApiScopeRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf>(!filter.IsNullOrWhiteSpace(), @@ -60,7 +60,7 @@ public class MongoApiScopeRepository : MongoDbRepository CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) + public virtual async Task CheckNameExistAsync(string name, Guid? expectedId = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .AnyAsync(x => x.Id != expectedId && x.Name == name, GetCancellationToken(cancellationToken)); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs index 3a6be89c8f..c7f81f51e2 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoClientRepository.cs @@ -47,7 +47,7 @@ public class MongoClientRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf>(!filter.IsNullOrWhiteSpace(), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs index b60077644b..faf3d66d96 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoIdentityResourceRepository.cs @@ -30,7 +30,7 @@ public class MongoIdentityResourceRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf>(!filter.IsNullOrWhiteSpace(), diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs index a4651def23..e3f3cc8368 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.MongoDB/Volo/Abp/IdentityServer/MongoDB/MongoPersistentGrantRepository.cs @@ -18,7 +18,7 @@ public class MongoPersistentGrantRepository : MongoDbRepository> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, + public virtual async Task> GetListAsync(string subjectId, string sessionId, string clientId, string type, bool includeDetails = false, CancellationToken cancellationToken = default) { return await (await FilterAsync(subjectId, sessionId, clientId, type, cancellationToken)) @@ -55,7 +55,7 @@ public class MongoPersistentGrantRepository : MongoDbRepository x.Expiration != null && x.Expiration < maxExpirationDate, cancellationToken: cancellationToken); } - public async Task DeleteAsync( + public virtual async Task DeleteAsync( string subjectId = null, string sessionId = null, string clientId = null, diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs index aadaac6ef0..88fdf44c72 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Applications/EfCoreOpenIddictApplicationRepository.cs @@ -19,7 +19,7 @@ public class EfCoreOpenIddictApplicationRepository : EfCoreRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -29,7 +29,7 @@ public class EfCoreOpenIddictApplicationRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs index 7f5481decb..754970c46d 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.EntityFrameworkCore/Volo/Abp/OpenIddict/Scopes/EfCoreOpenIddictScopeRepository.cs @@ -19,7 +19,7 @@ public class EfCoreOpenIddictScopeRepository : EfCoreRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) @@ -32,7 +32,7 @@ public class EfCoreOpenIddictScopeRepository : EfCoreRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .WhereIf(!filter.IsNullOrWhiteSpace(), x => diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs index 2f87117d55..836f4a7546 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Applications/MongoOpenIddictApplicationRepository.cs @@ -18,7 +18,7 @@ public class MongoOpenIddictApplicationRepository : MongoDbRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default) { return await ((await GetMongoQueryableAsync(cancellationToken))) @@ -29,7 +29,7 @@ public class MongoOpenIddictApplicationRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await ((await GetMongoQueryableAsync(cancellationToken))) .WhereIf(!filter.IsNullOrWhiteSpace(), x => x.ClientId.Contains(filter)) @@ -37,28 +37,28 @@ public class MongoOpenIddictApplicationRepository : MongoDbRepository FindByClientIdAsync(string clientId, CancellationToken cancellationToken = default) + public virtual async Task FindByClientIdAsync(string clientId, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .FirstOrDefaultAsync(x => x.ClientId == clientId, cancellationToken); } - public async Task> FindByPostLogoutRedirectUriAsync(string address, CancellationToken cancellationToken = default) + public virtual async Task> FindByPostLogoutRedirectUriAsync(string address, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.PostLogoutRedirectUris.Contains(address)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task> FindByRedirectUriAsync(string address, CancellationToken cancellationToken = default) + public virtual async Task> FindByRedirectUriAsync(string address, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)).Where(x => x.RedirectUris.Contains(address)).ToListAsync(GetCancellationToken(cancellationToken)); } - public async Task GetAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken = default) + public virtual async Task GetAsync(Func, TState, IQueryable> query, TState state, CancellationToken cancellationToken = default) { return await query(await GetMongoQueryableAsync(cancellationToken), state).As>().FirstOrDefaultAsync(GetCancellationToken(cancellationToken)); } - public async Task> ListAsync(int? count, int? offset, CancellationToken cancellationToken = default) + public virtual async Task> ListAsync(int? count, int? offset, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .OrderBy(x => x.Id) diff --git a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs index 3411f520e9..af42fbb4b6 100644 --- a/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs +++ b/modules/openiddict/src/Volo.Abp.OpenIddict.MongoDB/Volo/Abp/OpenIddict/Scopes/MongoOpenIddictScopeRepository.cs @@ -18,7 +18,7 @@ public class MongoOpenIddictScopeRepository : MongoDbRepository> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, + public virtual async Task> GetListAsync(string sorting, int skipCount, int maxResultCount, string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) @@ -32,7 +32,7 @@ public class MongoOpenIddictScopeRepository : MongoDbRepository GetCountAsync(string filter = null, CancellationToken cancellationToken = default) + public virtual async Task GetCountAsync(string filter = null, CancellationToken cancellationToken = default) { return await (await GetMongoQueryableAsync(cancellationToken)) .WhereIf(!filter.IsNullOrWhiteSpace(), x => diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionDefinitionRecordRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionDefinitionRecordRepository.cs index 09cf408f7d..444c0878e6 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionDefinitionRecordRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.EntityFrameworkCore/Volo/Abp/PermissionManagement/EntityFrameworkCore/EfCorePermissionDefinitionRecordRepository.cs @@ -18,7 +18,7 @@ public class EfCorePermissionDefinitionRecordRepository : { } - public async Task FindByNameAsync( + public virtual async Task FindByNameAsync( string name, CancellationToken cancellationToken = default) { diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionDefinitionRecordRepository.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionDefinitionRecordRepository.cs index e4894a1442..529f56511c 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionDefinitionRecordRepository.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.MongoDB/Volo/Abp/PermissionManagement/MongoDb/MongoPermissionDefinitionRecordRepository.cs @@ -17,7 +17,7 @@ public class MongoPermissionDefinitionRecordRepository : { } - public async Task FindByNameAsync( + public virtual async Task FindByNameAsync( string name, CancellationToken cancellationToken = default) {