From e90baa230145cbb0beb13daf82b8d0014f68684a Mon Sep 17 00:00:00 2001 From: liangshiwei Date: Fri, 1 Oct 2021 17:43:50 +0800 Subject: [PATCH] Introduce AbpControllerBase to create API Controllers --- .../Abp/MultiTenancy/AbpTenantController.cs | 3 +- .../Abp/AspNetCore/Mvc/AbpControllerBase.cs | 105 ++++++++++++++++++ .../AbpApplicationConfigurationController.cs | 2 +- .../Volo/Abp/Account/AccountController.cs | 2 +- .../Account/Controllers/AccountController.cs | 2 +- .../Admin/BlogManagementController.cs | 2 +- .../Volo/Blogging/BlogFilesController.cs | 2 +- .../Volo/Blogging/BlogsController.cs | 2 +- .../Volo/Blogging/CommentsController.cs | 2 +- .../Volo/Blogging/PostsController.cs | 2 +- .../Volo/Blogging/TagsController.cs | 2 +- .../CmsKit/Admin/CmsKitAdminController.cs | 2 +- .../Volo/CmsKit/CmsKitControllerBase.cs | 2 +- .../Docs/Admin/DocumentsAdminController.cs | 2 +- .../Docs/Admin/ProjectsAdminController.cs | 2 +- .../Docs/Projects/DocsProjectController.cs | 2 +- .../FeatureManagement/FeaturesController.cs | 2 +- .../Abp/Identity/IdentityRoleController.cs | 2 +- .../Abp/Identity/IdentityUserController.cs | 2 +- .../Identity/IdentityUserLookupController.cs | 2 +- .../Volo/Abp/Identity/ProfileController.cs | 2 +- .../PermissionsController.cs | 2 +- .../EmailSettingsController.cs | 2 +- .../Abp/TenantManagement/TenantController.cs | 2 +- .../MyProjectNameController.cs | 2 +- 25 files changed, 130 insertions(+), 24 deletions(-) create mode 100644 framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs index 712a768137..c0dfeecfc1 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc.UI.MultiTenancy/Pages/Abp/MultiTenancy/AbpTenantController.cs @@ -2,6 +2,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Volo.Abp; +using Volo.Abp.AspNetCore; using Volo.Abp.AspNetCore.Mvc; using Volo.Abp.AspNetCore.Mvc.MultiTenancy; @@ -10,7 +11,7 @@ namespace Pages.Abp.MultiTenancy [Area("abp")] [RemoteService(Name = "abp")] [Route("api/abp/multi-tenancy")] - public class AbpTenantController : AbpController, IAbpTenantAppService + public class AbpTenantController : AbpControllerBase, IAbpTenantAppService { private readonly IAbpTenantAppService _abpTenantAppService; diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs new file mode 100644 index 0000000000..20ad62991f --- /dev/null +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/AbpControllerBase.cs @@ -0,0 +1,105 @@ +using System; +using System.Collections.Generic; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Localization; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Logging.Abstractions; +using Volo.Abp.Aspects; +using Volo.Abp.AspNetCore.Mvc.Validation; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Features; +using Volo.Abp.Guids; +using Volo.Abp.Localization; +using Volo.Abp.MultiTenancy; +using Volo.Abp.ObjectMapping; +using Volo.Abp.Timing; +using Volo.Abp.Uow; +using Volo.Abp.Users; + +namespace Volo.Abp.AspNetCore.Mvc +{ + public abstract class AbpControllerBase : ControllerBase, IAvoidDuplicateCrossCuttingConcerns + { + public IAbpLazyServiceProvider LazyServiceProvider { get; set; } + + protected IUnitOfWorkManager UnitOfWorkManager => LazyServiceProvider.LazyGetRequiredService(); + + protected Type ObjectMapperContext { get; set; } + protected IObjectMapper ObjectMapper => LazyServiceProvider.LazyGetService(provider => + ObjectMapperContext == null + ? provider.GetRequiredService() + : (IObjectMapper) provider.GetRequiredService(typeof(IObjectMapper<>).MakeGenericType(ObjectMapperContext))); + + protected IGuidGenerator GuidGenerator => LazyServiceProvider.LazyGetService(SimpleGuidGenerator.Instance); + + protected ILoggerFactory LoggerFactory => LazyServiceProvider.LazyGetRequiredService(); + + protected ILogger Logger => LazyServiceProvider.LazyGetService(provider => LoggerFactory?.CreateLogger(GetType().FullName) ?? NullLogger.Instance); + + protected ICurrentUser CurrentUser => LazyServiceProvider.LazyGetRequiredService(); + + protected ICurrentTenant CurrentTenant => LazyServiceProvider.LazyGetRequiredService(); + + protected IAuthorizationService AuthorizationService => LazyServiceProvider.LazyGetRequiredService(); + + protected IUnitOfWork CurrentUnitOfWork => UnitOfWorkManager?.Current; + + protected IClock Clock => LazyServiceProvider.LazyGetRequiredService(); + + protected IModelStateValidator ModelValidator => LazyServiceProvider.LazyGetRequiredService(); + + protected IFeatureChecker FeatureChecker => LazyServiceProvider.LazyGetRequiredService(); + + protected IStringLocalizerFactory StringLocalizerFactory => LazyServiceProvider.LazyGetRequiredService(); + + protected IStringLocalizer L + { + get + { + if (_localizer == null) + { + _localizer = CreateLocalizer(); + } + + return _localizer; + } + } + private IStringLocalizer _localizer; + + protected Type LocalizationResource + { + get => _localizationResource; + set + { + _localizationResource = value; + _localizer = null; + } + } + private Type _localizationResource = typeof(DefaultResource); + + public List AppliedCrossCuttingConcerns { get; } = new List(); + + protected virtual IStringLocalizer CreateLocalizer() + { + if (LocalizationResource != null) + { + return StringLocalizerFactory.Create(LocalizationResource); + } + + var localizer = StringLocalizerFactory.CreateDefaultOrNull(); + if (localizer == null) + { + throw new AbpException($"Set {nameof(LocalizationResource)} or define the default localization resource type (by configuring the {nameof(AbpLocalizationOptions)}.{nameof(AbpLocalizationOptions.DefaultResourceType)}) to be able to use the {nameof(L)} object!"); + } + + return localizer; + } + + protected virtual void ValidateModel() + { + ModelValidator?.Validate(ModelState); + } + } +} diff --git a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs index 89282110b9..4947008411 100644 --- a/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs +++ b/framework/src/Volo.Abp.AspNetCore.Mvc/Volo/Abp/AspNetCore/Mvc/ApplicationConfigurations/AbpApplicationConfigurationController.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.AspNetCore.Mvc.ApplicationConfigurations [Area("abp")] [RemoteService(Name = "abp")] [Route("api/abp/application-configuration")] - public class AbpApplicationConfigurationController : AbpController, IAbpApplicationConfigurationAppService + public class AbpApplicationConfigurationController : AbpControllerBase, IAbpApplicationConfigurationAppService { private readonly IAbpApplicationConfigurationAppService _applicationConfigurationAppService; private readonly IAbpAntiForgeryManager _antiForgeryManager; diff --git a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs index d1f22587e8..13910ac6ab 100644 --- a/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.HttpApi/Volo/Abp/Account/AccountController.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Account [RemoteService(Name = AccountRemoteServiceConsts.RemoteServiceName)] [Area("account")] [Route("api/account")] - public class AccountController : AbpController, IAccountAppService + public class AccountController : AbpControllerBase, IAccountAppService { protected IAccountAppService AccountAppService { get; } diff --git a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs index ec9f26179d..dd8a853350 100644 --- a/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs +++ b/modules/account/src/Volo.Abp.Account.Web/Areas/Account/Controllers/AccountController.cs @@ -22,7 +22,7 @@ namespace Volo.Abp.Account.Web.Areas.Account.Controllers [ControllerName("Login")] [Area("account")] [Route("api/account")] - public class AccountController : AbpController + public class AccountController : AbpControllerBase { protected SignInManager SignInManager { get; } protected IdentityUserManager UserManager { get; } 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 ce6457dcc7..4ee705551e 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 @@ -13,7 +13,7 @@ namespace Volo.Blogging.Admin [RemoteService(Name = BloggingAdminRemoteServiceConsts.RemoteServiceName)] [Area("bloggingAdmin")] [Route("api/blogging/blogs/admin")] - public class BlogManagementController : AbpController, IBlogManagementAppService + public class BlogManagementController : AbpControllerBase, IBlogManagementAppService { private readonly IBlogManagementAppService _blogManagementAppService; 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 12bedc3e6c..898d3fe09b 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogFilesController.cs @@ -10,7 +10,7 @@ namespace Volo.Blogging [RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)] [Area("blogging")] [Route("api/blogging/files")] - public class BlogFilesController : AbpController, IFileAppService + public class BlogFilesController : AbpControllerBase, IFileAppService { private readonly IFileAppService _fileAppService; 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 9ef141b3de..af46d0784a 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/BlogsController.cs @@ -12,7 +12,7 @@ namespace Volo.Blogging [RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)] [Area("blogging")] [Route("api/blogging/blogs")] - public class BlogsController : AbpController, IBlogAppService + public class BlogsController : AbpControllerBase, IBlogAppService { private readonly IBlogAppService _blogAppService; diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs index caea1cfa2f..73d6a115f4 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/CommentsController.cs @@ -12,7 +12,7 @@ namespace Volo.Blogging [RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)] [Area("blogging")] [Route("api/blogging/comments")] - public class CommentsController : AbpController, ICommentAppService + public class CommentsController : AbpControllerBase, ICommentAppService { private readonly ICommentAppService _commentAppService; diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs index f3d67af815..66f8f7afab 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/PostsController.cs @@ -11,7 +11,7 @@ namespace Volo.Blogging [RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)] [Area("blogging")] [Route("api/blogging/posts")] - public class PostsController : AbpController, IPostAppService + public class PostsController : AbpControllerBase, IPostAppService { private readonly IPostAppService _postAppService; diff --git a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs index 4c2c34db44..262e5ac801 100644 --- a/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs +++ b/modules/blogging/src/Volo.Blogging.HttpApi/Volo/Blogging/TagsController.cs @@ -12,7 +12,7 @@ namespace Volo.Blogging [RemoteService(Name = BloggingRemoteServiceConsts.RemoteServiceName)] [Area("blogging")] [Route("api/blogging/tags")] - public class TagsController : AbpController, ITagAppService + public class TagsController : AbpControllerBase, ITagAppService { private readonly ITagAppService _tagAppService; diff --git a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/CmsKitAdminController.cs b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/CmsKitAdminController.cs index f4303c0245..fc89a0c63b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/CmsKitAdminController.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Admin.HttpApi/Volo/CmsKit/Admin/CmsKitAdminController.cs @@ -3,7 +3,7 @@ using Volo.CmsKit.Localization; namespace Volo.CmsKit.Admin { - public abstract class CmsKitAdminController : AbpController + public abstract class CmsKitAdminController : AbpControllerBase { protected CmsKitAdminController() { diff --git a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs index 70a68c7611..4ac5d5423b 100644 --- a/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs +++ b/modules/cms-kit/src/Volo.CmsKit.Common.HttpApi/Volo/CmsKit/CmsKitControllerBase.cs @@ -3,7 +3,7 @@ using Volo.CmsKit.Localization; namespace Volo.CmsKit { - public abstract class CmsKitControllerBase : AbpController + public abstract class CmsKitControllerBase : AbpControllerBase { protected CmsKitControllerBase() { 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 88b1d99d1d..f08c8e8f71 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 @@ -13,7 +13,7 @@ namespace Volo.Docs.Admin [Area("docs-admin")] [ControllerName("DocumentsAdmin")] [Route("api/docs/admin/documents")] - public class DocumentsAdminController : AbpController, IDocumentAdminAppService + public class DocumentsAdminController : AbpControllerBase, IDocumentAdminAppService { private readonly IDocumentAdminAppService _documentAdminAppService; diff --git a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs index 2e09342175..968e60adb7 100644 --- a/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs +++ b/modules/docs/src/Volo.Docs.Admin.HttpApi/Volo/Docs/Admin/ProjectsAdminController.cs @@ -12,7 +12,7 @@ namespace Volo.Docs.Admin [Area("docs-admin")] [ControllerName("ProjectsAdmin")] [Route("api/docs/admin/projects")] - public class ProjectsAdminController : AbpController, IProjectAdminAppService + public class ProjectsAdminController : AbpControllerBase, IProjectAdminAppService { private readonly IProjectAdminAppService _projectAppService; diff --git a/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs b/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs index 602cc970dd..24d9a51491 100644 --- a/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs +++ b/modules/docs/src/Volo.Docs.HttpApi/Volo/Docs/Projects/DocsProjectController.cs @@ -11,7 +11,7 @@ namespace Volo.Docs.Projects [Area("docs")] [ControllerName("Project")] [Route("api/docs/projects")] - public class DocsProjectController : AbpController, IProjectAppService + public class DocsProjectController : AbpControllerBase, IProjectAppService { protected IProjectAppService ProjectAppService { get; } diff --git a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs index c7dff4d8a3..4a70fefdd9 100644 --- a/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs +++ b/modules/feature-management/src/Volo.Abp.FeatureManagement.HttpApi/Volo/Abp/FeatureManagement/FeaturesController.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.FeatureManagement [RemoteService(Name = FeatureManagementRemoteServiceConsts.RemoteServiceName)] [Area("featureManagement")] [Route("api/feature-management/features")] - public class FeaturesController : AbpController, IFeatureAppService + public class FeaturesController : AbpControllerBase, IFeatureAppService { protected IFeatureAppService FeatureAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs index 150256badd..38d5f68a41 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Identity [Area("identity")] [ControllerName("Role")] [Route("api/identity/roles")] - public class IdentityRoleController : AbpController, IIdentityRoleAppService + public class IdentityRoleController : AbpControllerBase, IIdentityRoleAppService { protected IIdentityRoleAppService RoleAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs index c02ea23e9f..7de9de2826 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.Identity [Area("identity")] [ControllerName("User")] [Route("api/identity/users")] - public class IdentityUserController : AbpController, IIdentityUserAppService + public class IdentityUserController : AbpControllerBase, IIdentityUserAppService { protected IIdentityUserAppService UserAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs index 75fc20a520..d0676ffb7d 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserLookupController.cs @@ -11,7 +11,7 @@ namespace Volo.Abp.Identity [Area("identity")] [ControllerName("UserLookup")] [Route("api/identity/users/lookup")] - public class IdentityUserLookupController : AbpController, IIdentityUserLookupAppService + public class IdentityUserLookupController : AbpControllerBase, IIdentityUserLookupAppService { protected IIdentityUserLookupAppService LookupAppService { get; } diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs index 91b1bc8325..f16c780d93 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/ProfileController.cs @@ -8,7 +8,7 @@ namespace Volo.Abp.Identity [Area("identity")] [ControllerName("Profile")] [Route("/api/identity/my-profile")] - public class ProfileController : AbpController, IProfileAppService + public class ProfileController : AbpControllerBase, IProfileAppService { protected IProfileAppService ProfileAppService { get; } diff --git a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs index bb9db51f98..a9a6096053 100644 --- a/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs +++ b/modules/permission-management/src/Volo.Abp.PermissionManagement.HttpApi/Volo/Abp/PermissionManagement/PermissionsController.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.PermissionManagement [RemoteService(Name = PermissionManagementRemoteServiceConsts.RemoteServiceName)] [Area("permissionManagement")] [Route("api/permission-management/permissions")] - public class PermissionsController : AbpController, IPermissionAppService + public class PermissionsController : AbpControllerBase, IPermissionAppService { protected IPermissionAppService PermissionAppService { get; } diff --git a/modules/setting-management/src/Volo.Abp.SettingManagement.HttpApi/Volo/Abp/SettingManagement/EmailSettingsController.cs b/modules/setting-management/src/Volo.Abp.SettingManagement.HttpApi/Volo/Abp/SettingManagement/EmailSettingsController.cs index 7ddb284c64..5e01f5b984 100644 --- a/modules/setting-management/src/Volo.Abp.SettingManagement.HttpApi/Volo/Abp/SettingManagement/EmailSettingsController.cs +++ b/modules/setting-management/src/Volo.Abp.SettingManagement.HttpApi/Volo/Abp/SettingManagement/EmailSettingsController.cs @@ -7,7 +7,7 @@ namespace Volo.Abp.SettingManagement [RemoteService(Name = SettingManagementRemoteServiceConsts.RemoteServiceName)] [Area("settingManagement")] [Route("api/setting-management/emailing")] - public class EmailSettingsController : AbpController, IEmailSettingsAppService + public class EmailSettingsController : AbpControllerBase, IEmailSettingsAppService { private readonly IEmailSettingsAppService _emailSettingsAppService; diff --git a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs index 317e7e62d0..9c5062f96e 100644 --- a/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs +++ b/modules/tenant-management/src/Volo.Abp.TenantManagement.HttpApi/Volo/Abp/TenantManagement/TenantController.cs @@ -10,7 +10,7 @@ namespace Volo.Abp.TenantManagement [RemoteService(Name = TenantManagementRemoteServiceConsts.RemoteServiceName)] [Area("multi-tenancy")] [Route("api/multi-tenancy/tenants")] - public class TenantController : AbpController, ITenantAppService //TODO: Throws exception on validation if we inherit from Controller + public class TenantController : AbpControllerBase, ITenantAppService //TODO: Throws exception on validation if we inherit from Controller { protected ITenantAppService TenantAppService { get; } diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyProjectNameController.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyProjectNameController.cs index 1dd9a6c8b2..699cc3df56 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyProjectNameController.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/MyProjectNameController.cs @@ -3,7 +3,7 @@ using Volo.Abp.AspNetCore.Mvc; namespace MyCompanyName.MyProjectName { - public abstract class MyProjectNameController : AbpController + public abstract class MyProjectNameController : AbpControllerBase { protected MyProjectNameController() {