From 4c1e36f81d766789e998a6b80a6893c1253f443a Mon Sep 17 00:00:00 2001 From: maliming Date: Mon, 7 Oct 2019 15:23:17 +0800 Subject: [PATCH] Use Contextualized mappers on all modules Resolve #1845 --- .../Volo.Abp.Account.Web/AbpAccountWebModule.cs | 1 + .../Pages/Account/AccountPageModel.cs | 1 + .../Volo/Abp/BackgroundJobs/BackgroundJobStore.cs | 5 +++-- .../BackgroundJobs/BackgroundJobsDomainModule.cs | 1 + .../Volo/Blogging/BloggingAppServiceBase.cs | 14 ++++++++++++++ .../Volo/Blogging/BloggingApplicationModule.cs | 3 +-- .../Volo/Blogging/Blogs/BlogAppService.cs | 3 +-- .../Volo/Blogging/Comments/CommentAppService.cs | 3 +-- .../Volo/Blogging/Files/FileAppService.cs | 3 +-- .../Volo/Blogging/Posts/PostAppService.cs | 4 +--- .../Volo/Blogging/Tagging/TagAppService.cs | 3 +-- .../Blog/Controllers/BloggingControllerBase.cs | 14 ++++++++++++++ .../Areas/Blog/Controllers/CommentsController.cs | 3 ++- .../Areas/Blog/Controllers/PostsController.cs | 2 +- .../src/Volo.Blogging.Web/BloggingWebModule.cs | 7 ++----- .../Pages/Admin/Blogs/Create.cshtml.cs | 3 ++- .../Pages/Admin/Blogs/Edit.cshtml.cs | 3 ++- .../Pages/Admin/Blogs/Index.cshtml.cs | 3 ++- .../Pages/Blog/BloggingPageModel.cs | 12 ++++++++++++ .../Pages/Blog/Posts/Detail.cshtml.cs | 2 +- .../Pages/Blog/Posts/Edit.cshtml.cs | 2 +- .../Pages/Blog/Posts/Index.cshtml.cs | 2 +- .../Pages/Blog/Posts/New.cshtml.cs | 2 +- .../Volo/Abp/Blogging/Users/BlogUser_Test.cs | 4 ++-- .../Volo/Docs/Admin/DocsAdminApplicationModule.cs | 4 +++- .../Docs/Admin/Projects/ProjectAdminAppService.cs | 4 ++++ .../src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs | 2 ++ .../Pages/Docs/Admin/DocsAdminPageModel.cs | 12 ++++++++++++ .../Pages/Docs/Admin/Projects/Create.cshtml.cs | 2 +- .../Pages/Docs/Admin/Projects/Edit.cshtml.cs | 2 +- .../Pages/Docs/Admin/Projects/Index.cshtml.cs | 2 +- .../Volo/Docs/DocsAppServiceBase.cs | 14 ++++++++++++++ .../Volo/Docs/DocsApplicationModule.cs | 4 +++- .../Volo/Docs/Documents/DocumentAppService.cs | 2 +- .../Volo/Docs/Projects/ProjectAppService.cs | 2 +- modules/docs/src/Volo.Docs.Web/DocsWebModule.cs | 1 + .../Pages/Documents/Project/Index.cshtml.cs | 2 ++ .../AbpFeatureManagementApplicationModule.cs | 4 +++- .../Abp/FeatureManagement/FeatureAppService.cs | 2 +- .../FeatureManagementAppServiceBase.cs | 14 ++++++++++++++ .../AbpFeatureManagementWebModule.cs | 1 + .../FeatureManagementModal.cshtml.cs | 2 ++ .../AbpIdentityServerDomainModule.cs | 1 + .../Volo/Abp/IdentityServer/Clients/ClientStore.cs | 4 ++-- .../IdentityServer/Grants/PersistedGrantStore.cs | 5 +++-- .../Volo/Abp/IdentityServer/ResourceStore.cs | 4 ++-- .../AbpPermissionManagementWebModule.cs | 1 + .../PermissionManagementModal.cshtml.cs | 2 ++ .../AbpTenantManagementApplicationModule.cs | 4 +++- .../TenantManagementAppServiceBase.cs | 9 +++++++-- .../AbpTenantManagementDomainModule.cs | 4 +++- .../Volo/Abp/TenantManagement/TenantStore.cs | 4 ++-- .../AbpTenantManagementWebModule.cs | 1 + .../Tenants/ConnectionStringsModal.cshtml.cs | 2 +- .../TenantManagement/Tenants/CreateModal.cshtml.cs | 2 +- .../TenantManagement/Tenants/EditModal.cshtml.cs | 2 +- .../Pages/TenantManagement/Tenants/Index.cshtml.cs | 2 +- .../Tenants/TenantManagementPageModel.cs | 12 ++++++++++++ 58 files changed, 179 insertions(+), 56 deletions(-) create mode 100644 modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingAppServiceBase.cs create mode 100644 modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/BloggingControllerBase.cs create mode 100644 modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs create mode 100644 modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPageModel.cs create mode 100644 modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsAppServiceBase.cs create mode 100644 modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureManagementAppServiceBase.cs create mode 100644 modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/TenantManagementPageModel.cs diff --git a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs index 5cada69450..0f9f43795d 100644 --- a/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs +++ b/modules/account/src/Volo.Abp.Account.Web/AbpAccountWebModule.cs @@ -50,6 +50,7 @@ namespace Volo.Abp.Account.Web options.Conventions.AuthorizePage("/Account/Manage"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs index c1c1880650..e10b1fecdc 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Pages/Account/AccountPageModel.cs @@ -18,6 +18,7 @@ namespace Volo.Abp.Account.Web.Pages.Account protected AccountPageModel() { LocalizationResourceType = typeof(AccountResource); + ObjectMapperContext = typeof(AbpAccountWebModule); } protected RedirectResult RedirectSafely(string returnUrl, string returnUrlHash = null) diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs index eda224153f..dce8a31600 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobStore.cs @@ -9,11 +9,12 @@ namespace Volo.Abp.BackgroundJobs public class BackgroundJobStore : IBackgroundJobStore, ITransientDependency { protected IBackgroundJobRepository BackgroundJobRepository { get; } - protected IObjectMapper ObjectMapper { get; } + + protected IObjectMapper ObjectMapper { get; } public BackgroundJobStore( IBackgroundJobRepository backgroundJobRepository, - IObjectMapper objectMapper) + IObjectMapper objectMapper) { ObjectMapper = objectMapper; BackgroundJobRepository = backgroundJobRepository; diff --git a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs index 2ef1477d87..261051958c 100644 --- a/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs +++ b/modules/background-jobs/src/Volo.Abp.BackgroundJobs.Domain/Volo/Abp/BackgroundJobs/BackgroundJobsDomainModule.cs @@ -13,6 +13,7 @@ namespace Volo.Abp.BackgroundJobs { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingAppServiceBase.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingAppServiceBase.cs new file mode 100644 index 0000000000..169e7b283d --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingAppServiceBase.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Application.Services; +using Volo.Blogging.Localization; + +namespace Volo.Blogging +{ + public abstract class BloggingAppServiceBase : ApplicationService + { + protected BloggingAppServiceBase() + { + ObjectMapperContext = typeof(BloggingApplicationModule); + LocalizationResource = typeof(BloggingResource); + } + } +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs index 460f573d1d..31d24090a1 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/BloggingApplicationModule.cs @@ -17,13 +17,12 @@ namespace Volo.Blogging { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); }); - - Configure(options => { //TODO: Rename UpdatePolicy/DeletePolicy since it's candidate to conflicts with other modules! 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 f06864a2d6..b2f84df80d 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 @@ -3,13 +3,12 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using Volo.Abp.Domain.Entities; using Volo.Blogging.Blogs.Dtos; namespace Volo.Blogging.Blogs { - public class BlogAppService : ApplicationService, IBlogAppService + public class BlogAppService : BloggingAppServiceBase, IBlogAppService { private readonly IBlogRepository _blogRepository; 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 0ff7bc46cc..cf34edb434 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 @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Volo.Abp.Application.Services; using Volo.Abp.Guids; using Volo.Blogging.Comments.Dtos; using Volo.Blogging.Posts; @@ -11,7 +10,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.Comments { - public class CommentAppService : ApplicationService, ICommentAppService + public class CommentAppService : BloggingAppServiceBase, ICommentAppService { protected IBlogUserLookupService UserLookupService; diff --git a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs index b188fe4c3e..4673f5c6d1 100644 --- a/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs +++ b/modules/blogging/src/Volo.Blogging.Application/Volo/Blogging/Files/FileAppService.cs @@ -4,13 +4,12 @@ using System.IO; using System.Threading.Tasks; using Microsoft.Extensions.Options; using Volo.Abp; -using Volo.Abp.Application.Services; using Volo.Abp.Validation; using Volo.Blogging.Areas.Blog.Helpers; namespace Volo.Blogging.Files { - public class FileAppService : ApplicationService, IFileAppService + public class FileAppService : BloggingAppServiceBase, IFileAppService { public BlogFileOptions Options { get; } 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 6787718a21..a8232933a4 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 @@ -2,10 +2,8 @@ using System.Linq; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; -using Volo.Abp.Application.Services; using System.Collections.Generic; using Microsoft.AspNetCore.Authorization; -using Volo.Abp.Users; using Volo.Blogging.Comments; using Volo.Blogging.Tagging; using Volo.Blogging.Tagging.Dtos; @@ -13,7 +11,7 @@ using Volo.Blogging.Users; namespace Volo.Blogging.Posts { - public class PostAppService : ApplicationService, IPostAppService + public class PostAppService : BloggingAppServiceBase, IPostAppService { protected IBlogUserLookupService UserLookupService { get; } 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 0e6e75e071..7ea56ea2c8 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 @@ -2,12 +2,11 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using Volo.Abp.Application.Services; using Volo.Blogging.Tagging.Dtos; namespace Volo.Blogging.Tagging { - public class TagAppService : ApplicationService, ITagAppService + public class TagAppService : BloggingAppServiceBase, ITagAppService { private readonly ITagRepository _tagRepository; diff --git a/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/BloggingControllerBase.cs b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/BloggingControllerBase.cs new file mode 100644 index 0000000000..c68a3a61c0 --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/Areas/Blog/Controllers/BloggingControllerBase.cs @@ -0,0 +1,14 @@ +using Volo.Abp.AspNetCore.Mvc; +using Volo.Blogging.Localization; + +namespace Volo.Blogging.Areas.Blog.Controllers +{ + public abstract class BloggingControllerBase : AbpController + { + protected BloggingControllerBase() + { + ObjectMapperContext = typeof(BloggingWebModule); + LocalizationResource = typeof(BloggingResource); + } + } +} \ No newline at end of file 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 80ef132c21..26be2a914f 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 @@ -11,13 +11,14 @@ namespace Volo.Blogging.Areas.Blog.Controllers [Area("Blog")] [Route("Blog/[controller]/[action]")] - public class CommentsController : AbpController + public class CommentsController : BloggingControllerBase { private readonly ICommentAppService _commentAppService; public CommentsController(ICommentAppService commentAppService) { _commentAppService = commentAppService; + } [HttpPost] 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 383f08284f..406196a5f2 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 @@ -10,7 +10,7 @@ namespace Volo.Blogging.Areas.Blog.Controllers [Area("Blog")] [Route("Blog/[controller]/[action]")] - public class PostsController : AbpController + public class PostsController : BloggingControllerBase { private readonly IPostAppService _postAppService; diff --git a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs index 52d8f8751b..104380e646 100644 --- a/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs +++ b/modules/blogging/src/Volo.Blogging.Web/BloggingWebModule.cs @@ -1,13 +1,10 @@ -using Localization.Resources.AbpUi; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AspNetCore.Mvc.UI.Bundling; using Volo.Abp.AutoMapper; -using Volo.Abp.Localization; -using Volo.Abp.Localization.Resources.AbpValidation; using Volo.Abp.Modularity; using Volo.Abp.UI.Navigation; using Volo.Abp.VirtualFileSystem; @@ -43,7 +40,7 @@ namespace Volo.Blogging options.FileSets.AddEmbedded("Volo.Blogging"); }); - + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml.cs index 2469543ad7..c23661a0a2 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Create.cshtml.cs @@ -6,10 +6,11 @@ using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap.TagHelpers.Form; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; using Volo.Blogging.Blogs; using Volo.Blogging.Blogs.Dtos; +using Volo.Blogging.Pages.Blog; namespace Volo.Blogging.Pages.Admin.Blogs { - public class CreateModel : AbpPageModel + public class CreateModel : BloggingPageModel { private readonly IBlogAppService _blogAppService; private readonly IAuthorizationService _authorization; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml.cs index 4484eb8993..9a15efd829 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Edit.cshtml.cs @@ -7,11 +7,12 @@ using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; using Volo.Blogging.Blogs; using Volo.Blogging.Blogs.Dtos; +using Volo.Blogging.Pages.Blog; using Volo.Blogging.Posts; namespace Volo.Blogging.Pages.Admin.Blogs { - public class EditModel : AbpPageModel + public class EditModel : BloggingPageModel { private readonly IBlogAppService _blogAppService; private readonly IAuthorizationService _authorization; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml.cs index bb74d90652..367f19d60c 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Admin/Blogs/Index.cshtml.cs @@ -2,10 +2,11 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; +using Volo.Blogging.Pages.Blog; namespace Volo.Blogging.Pages.Admin.Blogs { - public class IndexModel : AbpPageModel + public class IndexModel : BloggingPageModel { private readonly IAuthorizationService _authorization; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs new file mode 100644 index 0000000000..856b37cbdd --- /dev/null +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/BloggingPageModel.cs @@ -0,0 +1,12 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Blogging.Pages.Blog +{ + public class BloggingPageModel : AbpPageModel + { + public BloggingPageModel() + { + ObjectMapperContext = typeof(BloggingWebModule); + } + } +} \ No newline at end of file diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs index 20f281f8ae..f6e86a2218 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Detail.cshtml.cs @@ -12,7 +12,7 @@ using Volo.Blogging.Posts; namespace Volo.Blogging.Pages.Blog.Posts { - public class DetailModel : AbpPageModel + public class DetailModel : BloggingPageModel { private const int TwitterLinkLength = 23; private readonly IPostAppService _postAppService; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs index 48da1b0c11..f228721e79 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Edit.cshtml.cs @@ -11,7 +11,7 @@ using Volo.Blogging.Posts; namespace Volo.Blogging.Pages.Blog.Posts { - public class EditModel : AbpPageModel + public class EditModel : BloggingPageModel { private readonly IPostAppService _postAppService; private readonly IBlogAppService _blogAppService; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs index 8702171d9f..f27d4e8f05 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/Index.cshtml.cs @@ -10,7 +10,7 @@ using Volo.Blogging.Tagging.Dtos; namespace Volo.Blogging.Pages.Blog.Posts { - public class IndexModel : AbpPageModel + public class IndexModel : BloggingPageModel { private readonly IPostAppService _postAppService; private readonly IBlogAppService _blogAppService; diff --git a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs index fe0a809d07..ad2dbc846f 100644 --- a/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs +++ b/modules/blogging/src/Volo.Blogging.Web/Pages/Blog/Posts/New.cshtml.cs @@ -11,7 +11,7 @@ using Volo.Blogging.Posts; namespace Volo.Blogging.Pages.Blog.Posts { - public class NewModel : AbpPageModel + public class NewModel : BloggingPageModel { private readonly IPostAppService _postAppService; private readonly IBlogAppService _blogAppService; diff --git a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs index e407d6f3f0..f3e334e3fd 100644 --- a/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs +++ b/modules/blogging/test/Volo.Blogging.Domain.Tests/Volo/Abp/Blogging/Users/BlogUser_Test.cs @@ -23,7 +23,7 @@ namespace Volo.Blogging blogUser.Update(userData); - blogUser.Equals(new BlogUser(userData)).ShouldBeTrue(); + blogUser.EntityEquals(new BlogUser(userData)).ShouldBeTrue(); } [Fact] @@ -65,7 +65,7 @@ namespace Volo.Blogging var blogUser2= new BlogUser(new UserData(userId, "bob lee", "john@volosoft.com", "lee", "bob", true, "123456", true, tenantId)); - blogUser.Equals(blogUser2).ShouldBeTrue(); + blogUser.EntityEquals(blogUser2).ShouldBeTrue(); } } } diff --git a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationModule.cs b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationModule.cs index 1771b00cdb..36e89b8b07 100644 --- a/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Application/Volo/Docs/Admin/DocsAdminApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Modularity; @@ -13,6 +14,7 @@ namespace Volo.Docs.Admin { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); 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 e8a760c940..d1812ec410 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 @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Authorization; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; using Volo.Abp.Guids; +using Volo.Docs.Localization; using Volo.Docs.Projects; namespace Volo.Docs.Admin.Projects @@ -18,6 +19,9 @@ namespace Volo.Docs.Admin.Projects public ProjectAdminAppService( IProjectRepository projectRepository, IGuidGenerator guidGenerator) { + ObjectMapperContext = typeof(DocsAdminApplicationModule); + LocalizationResource = typeof(DocsResource); + _projectRepository = projectRepository; _guidGenerator = guidGenerator; } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs index 7d2907d202..d7bb54fc5d 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/DocsAdminWebModule.cs @@ -1,4 +1,5 @@ using Localization.Resources.AbpUi; +using Microsoft.Extensions.DependencyInjection; using Volo.Abp.AspNetCore.Mvc.Localization; using Volo.Abp.AspNetCore.Mvc.UI.Bootstrap; using Volo.Abp.AutoMapper; @@ -40,6 +41,7 @@ namespace Volo.Docs.Admin options.FileSets.AddEmbedded("Volo.Docs.Admin"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPageModel.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPageModel.cs new file mode 100644 index 0000000000..bee39f5f6b --- /dev/null +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/DocsAdminPageModel.cs @@ -0,0 +1,12 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Docs.Admin.Pages.Docs.Admin +{ + public class DocsAdminPageModel : AbpPageModel + { + public DocsAdminPageModel() + { + ObjectMapperContext = typeof(DocsAdminWebModule); + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs index 7df02eec0c..4e5cbd1fbc 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Create.cshtml.cs @@ -14,7 +14,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects { - public class CreateModel : AbpPageModel + public class CreateModel : DocsAdminPageModel { [BindProperty] public CreateGithubProjectViewModel GithubProject { get; set; } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs index 8f9ce3fe4a..e1b83b8177 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Edit.cshtml.cs @@ -14,7 +14,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects { - public class EditModel : AbpPageModel + public class EditModel : DocsAdminPageModel { [BindProperty] public EditGithubProjectViewModel GithubProject { get; set; } diff --git a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs index 0ee140360e..de530d36b8 100644 --- a/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Admin.Web/Pages/Docs/Admin/Projects/Index.cshtml.cs @@ -4,7 +4,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace Volo.Docs.Admin.Pages.Docs.Admin.Projects { [Authorize(DocsAdminPermissions.Projects.Default)] - public class IndexModel : AbpPageModel + public class IndexModel : DocsAdminPageModel { public void OnGet() { diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsAppServiceBase.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsAppServiceBase.cs new file mode 100644 index 0000000000..b6fb4d258e --- /dev/null +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsAppServiceBase.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Application.Services; +using Volo.Docs.Localization; + +namespace Volo.Docs +{ + public abstract class DocsAppServiceBase : ApplicationService + { + protected DocsAppServiceBase() + { + ObjectMapperContext = typeof(DocsApplicationModule); + LocalizationResource = typeof(DocsResource); + } + } +} \ No newline at end of file diff --git a/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsApplicationModule.cs b/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsApplicationModule.cs index 66bbf0544b..b3e9f579be 100644 --- a/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsApplicationModule.cs +++ b/modules/docs/src/Volo.Docs.Application/Volo/Docs/DocsApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Caching; using Volo.Abp.Modularity; @@ -13,6 +14,7 @@ namespace Volo.Docs { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); 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 cdc50f869d..186f9827b0 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 @@ -11,7 +11,7 @@ using Volo.Docs.Projects; namespace Volo.Docs.Documents { - public class DocumentAppService : ApplicationService, IDocumentAppService + public class DocumentAppService : DocsAppServiceBase, IDocumentAppService { private readonly IProjectRepository _projectRepository; private readonly IDocumentStoreFactory _documentStoreFactory; 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 99a6c70123..13d2ad0ced 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 @@ -11,7 +11,7 @@ using Volo.Docs.Documents; namespace Volo.Docs.Projects { - public class ProjectAppService : ApplicationService, IProjectAppService + public class ProjectAppService : DocsAppServiceBase, IProjectAppService { private readonly IProjectRepository _projectRepository; private readonly IDistributedCache> _versionCache; diff --git a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs index f128aacfd1..9253176e58 100644 --- a/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs +++ b/modules/docs/src/Volo.Docs.Web/DocsWebModule.cs @@ -52,6 +52,7 @@ namespace Volo.Docs options.Conventions.AddPageRoute("/Documents/Project/Index", routePrefix + "{languageCode}/{projectName}/{version}/{*documentName}"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs index 1b5c446e04..ffa0e27739 100644 --- a/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs +++ b/modules/docs/src/Volo.Docs.Web/Pages/Documents/Project/Index.cshtml.cs @@ -67,6 +67,8 @@ namespace Volo.Docs.Pages.Documents.Project IProjectAppService projectAppService, IOptions options) { + ObjectMapperContext = typeof(DocsWebModule); + _documentAppService = documentAppService; _documentToHtmlConverterFactory = documentToHtmlConverterFactory; _projectAppService = projectAppService; diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/AbpFeatureManagementApplicationModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/AbpFeatureManagementApplicationModule.cs index 62ee615a10..c570606e15 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/AbpFeatureManagementApplicationModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/AbpFeatureManagementApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace Volo.Abp.FeatureManagement @@ -12,6 +13,7 @@ namespace Volo.Abp.FeatureManagement { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs index 71b41c26e8..d7f22193d0 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureAppService.cs @@ -13,7 +13,7 @@ using Volo.Abp.Features; namespace Volo.Abp.FeatureManagement { [Authorize] - public class FeatureAppService : ApplicationService, IFeatureAppService + public class FeatureAppService : FeatureManagementAppServiceBase, IFeatureAppService { protected FeatureManagementOptions Options { get; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureManagementAppServiceBase.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureManagementAppServiceBase.cs new file mode 100644 index 0000000000..d5c5877808 --- /dev/null +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Application/Volo/Abp/FeatureManagement/FeatureManagementAppServiceBase.cs @@ -0,0 +1,14 @@ +using Volo.Abp.Application.Services; +using Volo.Abp.FeatureManagement.Localization; + +namespace Volo.Abp.FeatureManagement +{ + public abstract class FeatureManagementAppServiceBase : ApplicationService + { + protected FeatureManagementAppServiceBase() + { + ObjectMapperContext = typeof(AbpFeatureManagementApplicationModule); + LocalizationResource = typeof(AbpFeatureManagementResource); + } + } +} \ No newline at end of file diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs index 67a178dfbd..e9d80ec0bc 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/AbpFeatureManagementWebModule.cs @@ -31,6 +31,7 @@ namespace Volo.Abp.FeatureManagement options.FileSets.AddEmbedded("Volo.Abp.FeatureManagement"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs index 23e46de955..d9e0d7b2c4 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.Web/Pages/FeatureManagement/FeatureManagementModal.cshtml.cs @@ -29,6 +29,8 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement public FeatureManagementModal(IFeatureAppService featureAppService) { + ObjectMapperContext = typeof(AbpFeatureManagementWebModule); + _featureAppService = featureAppService; } diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs index dbda3dd9aa..7bb3ab1750 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/AbpIdentityServerDomainModule.cs @@ -23,6 +23,7 @@ namespace Volo.Abp.IdentityServer { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs index c99686000f..0e88b658cd 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Clients/ClientStore.cs @@ -7,9 +7,9 @@ namespace Volo.Abp.IdentityServer.Clients public class ClientStore : IClientStore { private readonly IClientRepository _clientRepository; - private readonly IObjectMapper _objectMapper; + private readonly IObjectMapper _objectMapper; - public ClientStore(IClientRepository clientRepository, IObjectMapper objectMapper) + public ClientStore(IClientRepository clientRepository, IObjectMapper objectMapper) { _clientRepository = clientRepository; _objectMapper = objectMapper; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs index 400b5c0e26..5ff3831e0e 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/Grants/PersistedGrantStore.cs @@ -11,10 +11,11 @@ namespace Volo.Abp.IdentityServer.Grants public class PersistedGrantStore : IPersistedGrantStore { private readonly IPersistentGrantRepository _persistentGrantRepository; - private readonly IObjectMapper _objectMapper; + private readonly IObjectMapper _objectMapper; private readonly IGuidGenerator _guidGenerator; - public PersistedGrantStore(IPersistentGrantRepository persistentGrantRepository, IObjectMapper objectMapper, IGuidGenerator guidGenerator) + public PersistedGrantStore(IPersistentGrantRepository persistentGrantRepository, + IObjectMapper objectMapper, IGuidGenerator guidGenerator) { _persistentGrantRepository = persistentGrantRepository; _objectMapper = objectMapper; diff --git a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs index 8b2e79271a..56275bb386 100644 --- a/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs +++ b/modules/identityserver/src/Volo.Abp.IdentityServer.Domain/Volo/Abp/IdentityServer/ResourceStore.cs @@ -15,11 +15,11 @@ namespace Volo.Abp.IdentityServer { private readonly IIdentityResourceRepository _identityResourceRepository; private readonly IApiResourceRepository _apiResourceRepository; - private readonly IObjectMapper _objectMapper; + private readonly IObjectMapper _objectMapper; public ResourceStore( IIdentityResourceRepository identityResourceRepository, - IObjectMapper objectMapper, + IObjectMapper objectMapper, IApiResourceRepository apiResourceRepository) { _identityResourceRepository = identityResourceRepository; diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs index 75e81aa1e5..1655c6cba9 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/AbpPermissionManagementWebModule.cs @@ -32,6 +32,7 @@ namespace Volo.Abp.PermissionManagement.Web options.FileSets.AddEmbedded("Volo.Abp.PermissionManagement.Web"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs index 3bc688a6f1..70ec393455 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.Web/Pages/AbpPermissionManagement/PermissionManagementModal.cshtml.cs @@ -33,6 +33,8 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement public PermissionManagementModal(IPermissionAppService permissionAppService) { + ObjectMapperContext = typeof(AbpPermissionManagementWebModule); + _permissionAppService = permissionAppService; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/AbpTenantManagementApplicationModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/AbpTenantManagementApplicationModule.cs index 1eb7fdf28e..5f7cece529 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/AbpTenantManagementApplicationModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/AbpTenantManagementApplicationModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Modularity; namespace Volo.Abp.TenantManagement @@ -10,6 +11,7 @@ namespace Volo.Abp.TenantManagement { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantManagementAppServiceBase.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantManagementAppServiceBase.cs index bd68ec9f39..5f590d3106 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantManagementAppServiceBase.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Application/Volo/Abp/TenantManagement/TenantManagementAppServiceBase.cs @@ -1,9 +1,14 @@ using Volo.Abp.Application.Services; +using Volo.Abp.TenantManagement.Localization; namespace Volo.Abp.TenantManagement { - public class TenantManagementAppServiceBase : ApplicationService + public abstract class TenantManagementAppServiceBase : ApplicationService { - + protected TenantManagementAppServiceBase() + { + ObjectMapperContext = typeof(AbpTenantManagementApplicationModule); + LocalizationResource = typeof(AbpTenantManagementResource); + } } } \ No newline at end of file diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs index f22b508afb..c179af1219 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/AbpTenantManagementDomainModule.cs @@ -1,4 +1,5 @@ -using Volo.Abp.AutoMapper; +using Microsoft.Extensions.DependencyInjection; +using Volo.Abp.AutoMapper; using Volo.Abp.Data; using Volo.Abp.Domain; using Volo.Abp.Modularity; @@ -17,6 +18,7 @@ namespace Volo.Abp.TenantManagement { public override void ConfigureServices(ServiceConfigurationContext context) { + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs index 1cd1c60c0a..cc0788d634 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Domain/Volo/Abp/TenantManagement/TenantStore.cs @@ -11,12 +11,12 @@ namespace Volo.Abp.TenantManagement public class TenantStore : ITenantStore, ITransientDependency { private readonly ITenantRepository _tenantRepository; - private readonly IObjectMapper _objectMapper; + private readonly IObjectMapper _objectMapper; private readonly ICurrentTenant _currentTenant; public TenantStore( ITenantRepository tenantRepository, - IObjectMapper objectMapper, + IObjectMapper objectMapper, ICurrentTenant currentTenant) { _tenantRepository = tenantRepository; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs index 0ff8b1ae8e..f96052ec38 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/AbpTenantManagementWebModule.cs @@ -42,6 +42,7 @@ namespace Volo.Abp.TenantManagement.Web options.FileSets.AddEmbedded("Volo.Abp.TenantManagement.Web"); }); + context.Services.AddAutoMapperObjectMapper(); Configure(options => { options.AddProfile(validate: true); diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs index a4db743263..481cc6b7ca 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/ConnectionStringsModal.cshtml.cs @@ -6,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { - public class ConnectionStringsModal : AbpPageModel + public class ConnectionStringsModal : TenantManagementPageModel { [BindProperty] public TenantInfoModel Tenant { get; set; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs index 66a67052ce..a602b12a65 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/CreateModal.cshtml.cs @@ -5,7 +5,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { - public class CreateModalModel : AbpPageModel + public class CreateModalModel : TenantManagementPageModel { [BindProperty] public TenantInfoModel Tenant { get; set; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs index beef5ae85f..58516e8ff7 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/EditModal.cshtml.cs @@ -6,7 +6,7 @@ using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { - public class EditModalModel : AbpPageModel + public class EditModalModel : TenantManagementPageModel { [BindProperty] public TenantInfoModel Tenant { get; set; } diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml.cs index c297f3d010..8737d90bcf 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/Index.cshtml.cs @@ -2,7 +2,7 @@ using Microsoft.AspNetCore.Mvc.RazorPages; namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants { - public class IndexModel : PageModel + public class IndexModel : TenantManagementPageModel { public void OnGet() { diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/TenantManagementPageModel.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/TenantManagementPageModel.cs new file mode 100644 index 0000000000..3afa8fa06a --- /dev/null +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.Web/Pages/TenantManagement/Tenants/TenantManagementPageModel.cs @@ -0,0 +1,12 @@ +using Volo.Abp.AspNetCore.Mvc.UI.RazorPages; + +namespace Volo.Abp.TenantManagement.Web.Pages.TenantManagement.Tenants +{ + public class TenantManagementPageModel : AbpPageModel + { + public TenantManagementPageModel() + { + ObjectMapperContext = typeof(AbpTenantManagementWebModule); + } + } +} \ No newline at end of file