Use Contextualized mappers on all modules

Resolve #1845
pull/1855/head
maliming 6 years ago
parent 9055f5ca67
commit 4c1e36f81d

@ -50,6 +50,7 @@ namespace Volo.Abp.Account.Web
options.Conventions.AuthorizePage("/Account/Manage");
});
context.Services.AddAutoMapperObjectMapper<AbpAccountWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpAccountWebAutoMapperProfile>(validate: true);

@ -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)

@ -9,11 +9,12 @@ namespace Volo.Abp.BackgroundJobs
public class BackgroundJobStore : IBackgroundJobStore, ITransientDependency
{
protected IBackgroundJobRepository BackgroundJobRepository { get; }
protected IObjectMapper ObjectMapper { get; }
protected IObjectMapper<BackgroundJobsDomainModule> ObjectMapper { get; }
public BackgroundJobStore(
IBackgroundJobRepository backgroundJobRepository,
IObjectMapper objectMapper)
IObjectMapper<BackgroundJobsDomainModule> objectMapper)
{
ObjectMapper = objectMapper;
BackgroundJobRepository = backgroundJobRepository;

@ -13,6 +13,7 @@ namespace Volo.Abp.BackgroundJobs
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<BackgroundJobsDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<BackgroundJobsDomainAutoMapperProfile>(validate: true);

@ -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);
}
}
}

@ -17,13 +17,12 @@ namespace Volo.Blogging
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<BloggingApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<BloggingApplicationAutoMapperProfile>(validate: true);
});
Configure<AuthorizationOptions>(options =>
{
//TODO: Rename UpdatePolicy/DeletePolicy since it's candidate to conflicts with other modules!

@ -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;

@ -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;

@ -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; }

@ -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; }

@ -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;

@ -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);
}
}
}

@ -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]

@ -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;

@ -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<BloggingWebModule>("Volo.Blogging");
});
context.Services.AddAutoMapperObjectMapper<BloggingWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpBloggingWebAutoMapperProfile>(validate: true);

@ -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;

@ -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;

@ -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;

@ -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);
}
}
}

@ -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;

@ -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;

@ -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;

@ -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;

@ -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();
}
}
}

@ -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<DocsAdminApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DocsAdminApplicationAutoMapperProfile>(validate: true);

@ -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;
}

@ -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<DocsAdminWebModule>("Volo.Docs.Admin");
});
context.Services.AddAutoMapperObjectMapper<DocsAdminWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DocsAdminWebAutoMapperProfile>(validate: true);

@ -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);
}
}
}

@ -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; }

@ -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; }

@ -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()
{

@ -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);
}
}
}

@ -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<DocsApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DocsApplicationAutoMapperProfile>(validate: true);

@ -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;

@ -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<List<VersionInfo>> _versionCache;

@ -52,6 +52,7 @@ namespace Volo.Docs
options.Conventions.AddPageRoute("/Documents/Project/Index", routePrefix + "{languageCode}/{projectName}/{version}/{*documentName}");
});
context.Services.AddAutoMapperObjectMapper<DocsWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<DocsWebAutoMapperProfile>(validate: true);

@ -67,6 +67,8 @@ namespace Volo.Docs.Pages.Documents.Project
IProjectAppService projectAppService,
IOptions<DocsUiOptions> options)
{
ObjectMapperContext = typeof(DocsWebModule);
_documentAppService = documentAppService;
_documentToHtmlConverterFactory = documentToHtmlConverterFactory;
_projectAppService = projectAppService;

@ -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<AbpFeatureManagementApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<FeatureManagementApplicationAutoMapperProfile>(validate: true);

@ -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; }

@ -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);
}
}
}

@ -31,6 +31,7 @@ namespace Volo.Abp.FeatureManagement
options.FileSets.AddEmbedded<AbpFeatureManagementWebModule>("Volo.Abp.FeatureManagement");
});
context.Services.AddAutoMapperObjectMapper<AbpFeatureManagementWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<FeatureManagementWebAutoMapperProfile>(validate: true);

@ -29,6 +29,8 @@ namespace Volo.Abp.FeatureManagement.Web.Pages.FeatureManagement
public FeatureManagementModal(IFeatureAppService featureAppService)
{
ObjectMapperContext = typeof(AbpFeatureManagementWebModule);
_featureAppService = featureAppService;
}

@ -23,6 +23,7 @@ namespace Volo.Abp.IdentityServer
{
public override void ConfigureServices(ServiceConfigurationContext context)
{
context.Services.AddAutoMapperObjectMapper<AbpIdentityServerDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<ClientAutoMapperProfile>(validate: true);

@ -7,9 +7,9 @@ namespace Volo.Abp.IdentityServer.Clients
public class ClientStore : IClientStore
{
private readonly IClientRepository _clientRepository;
private readonly IObjectMapper _objectMapper;
private readonly IObjectMapper<AbpIdentityServerDomainModule> _objectMapper;
public ClientStore(IClientRepository clientRepository, IObjectMapper objectMapper)
public ClientStore(IClientRepository clientRepository, IObjectMapper<AbpIdentityServerDomainModule> objectMapper)
{
_clientRepository = clientRepository;
_objectMapper = objectMapper;

@ -11,10 +11,11 @@ namespace Volo.Abp.IdentityServer.Grants
public class PersistedGrantStore : IPersistedGrantStore
{
private readonly IPersistentGrantRepository _persistentGrantRepository;
private readonly IObjectMapper _objectMapper;
private readonly IObjectMapper<AbpIdentityServerDomainModule> _objectMapper;
private readonly IGuidGenerator _guidGenerator;
public PersistedGrantStore(IPersistentGrantRepository persistentGrantRepository, IObjectMapper objectMapper, IGuidGenerator guidGenerator)
public PersistedGrantStore(IPersistentGrantRepository persistentGrantRepository,
IObjectMapper<AbpIdentityServerDomainModule> objectMapper, IGuidGenerator guidGenerator)
{
_persistentGrantRepository = persistentGrantRepository;
_objectMapper = objectMapper;

@ -15,11 +15,11 @@ namespace Volo.Abp.IdentityServer
{
private readonly IIdentityResourceRepository _identityResourceRepository;
private readonly IApiResourceRepository _apiResourceRepository;
private readonly IObjectMapper _objectMapper;
private readonly IObjectMapper<AbpIdentityServerDomainModule> _objectMapper;
public ResourceStore(
IIdentityResourceRepository identityResourceRepository,
IObjectMapper objectMapper,
IObjectMapper<AbpIdentityServerDomainModule> objectMapper,
IApiResourceRepository apiResourceRepository)
{
_identityResourceRepository = identityResourceRepository;

@ -32,6 +32,7 @@ namespace Volo.Abp.PermissionManagement.Web
options.FileSets.AddEmbedded<AbpPermissionManagementWebModule>("Volo.Abp.PermissionManagement.Web");
});
context.Services.AddAutoMapperObjectMapper<AbpPermissionManagementWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpPermissionManagementWebAutoMapperProfile>(validate: true);

@ -33,6 +33,8 @@ namespace Volo.Abp.PermissionManagement.Web.Pages.AbpPermissionManagement
public PermissionManagementModal(IPermissionAppService permissionAppService)
{
ObjectMapperContext = typeof(AbpPermissionManagementWebModule);
_permissionAppService = permissionAppService;
}

@ -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<AbpTenantManagementApplicationModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpTenantManagementApplicationAutoMapperProfile>(validate: true);

@ -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);
}
}
}

@ -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<AbpTenantManagementDomainModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpTenantManagementDomainMappingProfile>(validate: true);

@ -11,12 +11,12 @@ namespace Volo.Abp.TenantManagement
public class TenantStore : ITenantStore, ITransientDependency
{
private readonly ITenantRepository _tenantRepository;
private readonly IObjectMapper _objectMapper;
private readonly IObjectMapper<AbpTenantManagementDomainModule> _objectMapper;
private readonly ICurrentTenant _currentTenant;
public TenantStore(
ITenantRepository tenantRepository,
IObjectMapper objectMapper,
IObjectMapper<AbpTenantManagementDomainModule> objectMapper,
ICurrentTenant currentTenant)
{
_tenantRepository = tenantRepository;

@ -42,6 +42,7 @@ namespace Volo.Abp.TenantManagement.Web
options.FileSets.AddEmbedded<AbpTenantManagementWebModule>("Volo.Abp.TenantManagement.Web");
});
context.Services.AddAutoMapperObjectMapper<AbpTenantManagementWebModule>();
Configure<AbpAutoMapperOptions>(options =>
{
options.AddProfile<AbpTenantManagementWebAutoMapperProfile>(validate: true);

@ -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; }

@ -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; }

@ -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; }

@ -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()
{

@ -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);
}
}
}
Loading…
Cancel
Save