diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj index 6921ac3af0..be6c316292 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj @@ -28,6 +28,7 @@ + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs index 447c4e979a..de70793f38 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs @@ -52,6 +52,7 @@ namespace MyCompanyName.MyProjectName [DependsOn( typeof(AbpAccountWebIdentityServerModule), typeof(AbpAccountApplicationModule), + typeof(AbpAccountHttpApiModule), typeof(AbpAspNetCoreMvcUiMultiTenancyModule), typeof(AbpAspNetCoreMvcModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj index fa9eb63367..6e8d37e963 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj @@ -24,23 +24,29 @@ + + + + + + diff --git a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs index d4b6d3f310..3a7217743a 100644 --- a/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs +++ b/templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs @@ -29,6 +29,7 @@ using Volo.Abp.Modularity; using Volo.Abp.MultiTenancy; using Volo.Abp.PermissionManagement; using Volo.Abp.PermissionManagement.EntityFrameworkCore; +using Volo.Abp.PermissionManagement.HttpApi; using Volo.Abp.PermissionManagement.Identity; using Volo.Abp.SettingManagement.EntityFrameworkCore; using Volo.Abp.Swashbuckle; @@ -43,24 +44,30 @@ namespace MyCompanyName.MyProjectName [DependsOn( typeof(MyProjectNameWebModule), typeof(MyProjectNameApplicationModule), + typeof(MyProjectNameHttpApiModule), typeof(MyProjectNameEntityFrameworkCoreModule), typeof(AbpAuditLoggingEntityFrameworkCoreModule), typeof(AbpAutofacModule), typeof(AbpAccountWebModule), typeof(AbpAccountApplicationModule), + typeof(AbpAccountHttpApiModule), typeof(AbpEntityFrameworkCoreSqlServerModule), typeof(AbpSettingManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementEntityFrameworkCoreModule), typeof(AbpPermissionManagementApplicationModule), + typeof(AbpPermissionManagementHttpApiModule), typeof(AbpIdentityWebModule), typeof(AbpIdentityApplicationModule), + typeof(AbpIdentityHttpApiModule), typeof(AbpIdentityEntityFrameworkCoreModule), typeof(AbpPermissionManagementDomainIdentityModule), typeof(AbpFeatureManagementWebModule), typeof(AbpFeatureManagementApplicationModule), + typeof(AbpFeatureManagementHttpApiModule), typeof(AbpFeatureManagementEntityFrameworkCoreModule), typeof(AbpTenantManagementWebModule), typeof(AbpTenantManagementApplicationModule), + typeof(AbpTenantManagementHttpApiModule), typeof(AbpTenantManagementEntityFrameworkCoreModule), typeof(AbpAspNetCoreMvcUiBasicThemeModule), typeof(AbpAspNetCoreSerilogModule), diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/MyProjectName-generate-proxy.json b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/MyProjectName-generate-proxy.json new file mode 100644 index 0000000000..0c806b2f57 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/MyProjectName-generate-proxy.json @@ -0,0 +1,53 @@ +{ + "modules": { + "MyProjectName": { + "rootPath": "MyProjectName", + "remoteServiceName": "MyProjectName", + "controllers": { + "MyCompanyName.MyProjectName.Samples.SampleController": { + "controllerName": "Sample", + "controllerGroupName": "Sample", + "type": "MyCompanyName.MyProjectName.Samples.SampleController", + "interfaces": [ + { + "type": "MyCompanyName.MyProjectName.Samples.ISampleAppService" + } + ], + "actions": { + "GetAsync": { + "uniqueName": "GetAsync", + "name": "GetAsync", + "httpMethod": "GET", + "url": "api/MyProjectName/sample", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "MyCompanyName.MyProjectName.Samples.SampleDto", + "typeSimple": "MyCompanyName.MyProjectName.Samples.SampleDto" + }, + "allowAnonymous": null, + "implementFrom": "MyCompanyName.MyProjectName.Samples.ISampleAppService" + }, + "GetAuthorizedAsync": { + "uniqueName": "GetAuthorizedAsync", + "name": "GetAuthorizedAsync", + "httpMethod": "GET", + "url": "api/MyProjectName/sample/authorized", + "supportedVersions": [], + "parametersOnMethod": [], + "parameters": [], + "returnValue": { + "type": "MyCompanyName.MyProjectName.Samples.SampleDto", + "typeSimple": "MyCompanyName.MyProjectName.Samples.SampleDto" + }, + "allowAnonymous": false, + "implementFrom": "MyCompanyName.MyProjectName.Samples.ISampleAppService" + } + } + } + } + } + }, + "types": {} +} \ No newline at end of file diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs new file mode 100644 index 0000000000..e73241ee35 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs @@ -0,0 +1,28 @@ +// This file is automatically generated by ABP framework to use MVC Controllers from CSharp +using System; +using System.Threading.Tasks; +using Volo.Abp.Application.Dtos; +using Volo.Abp.Http.Client; +using Volo.Abp.Http.Modeling; +using Volo.Abp.DependencyInjection; +using Volo.Abp.Http.Client.ClientProxying; +using MyCompanyName.MyProjectName.Samples; + +// ReSharper disable once CheckNamespace +namespace MyCompanyName.MyProjectName.Samples.ClientProxies +{ + [Dependency(ReplaceServices = true)] + [ExposeServices(typeof(ISampleAppService), typeof(SampleClientProxy))] + public partial class SampleClientProxy : ClientProxyBase, ISampleAppService + { + public virtual async Task GetAsync() + { + return await RequestAsync(nameof(GetAsync)); + } + + public virtual async Task GetAuthorizedAsync() + { + return await RequestAsync(nameof(GetAuthorizedAsync)); + } + } +} diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.cs new file mode 100644 index 0000000000..b8b7874053 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.cs @@ -0,0 +1,8 @@ +// This file is part of SampleClientProxy, you can customize it here +// ReSharper disable once CheckNamespace +namespace MyCompanyName.MyProjectName.Samples.ClientProxies +{ + public partial class SampleClientProxy + { + } +} diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyProjectNameHttpApiClientModule.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyProjectNameHttpApiClientModule.cs index ecf17f49e4..12929adf06 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyProjectNameHttpApiClientModule.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyProjectNameHttpApiClientModule.cs @@ -12,7 +12,7 @@ namespace MyCompanyName.MyProjectName { public override void ConfigureServices(ServiceConfigurationContext context) { - context.Services.AddHttpClientProxies( + context.Services.AddStaticHttpClientProxies( typeof(MyProjectNameApplicationContractsModule).Assembly, MyProjectNameRemoteServiceConsts.RemoteServiceName ); diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Samples/SampleController.cs b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Samples/SampleController.cs index 9d4ef179c9..3d868495b9 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Samples/SampleController.cs +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Samples/SampleController.cs @@ -5,6 +5,7 @@ using Volo.Abp; namespace MyCompanyName.MyProjectName.Samples { + [Area("MyProjectName")] [RemoteService(Name = MyProjectNameRemoteServiceConsts.RemoteServiceName)] [Route("api/MyProjectName/sample")] public class SampleController : MyProjectNameController, ISampleAppService diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml index 5807d89d9a..20fecbff87 100644 --- a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml @@ -1,8 +1,16 @@ @page @using Microsoft.Extensions.Localization @using MyCompanyName.MyProjectName.Localization +@using MyCompanyName.MyProjectName.Web.Pages.MyProjectName @model MyCompanyName.MyProjectName.Web.Pages.MyProjectName.IndexModel @inject IStringLocalizer L + +@section scripts { + + + +} + @{ }

MyProjectName

diff --git a/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/client-proxies/MyProjectName-proxy.js b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/client-proxies/MyProjectName-proxy.js new file mode 100644 index 0000000000..563b98a3f9 --- /dev/null +++ b/templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/client-proxies/MyProjectName-proxy.js @@ -0,0 +1,32 @@ +/* This file is automatically generated by ABP framework to use MVC Controllers from javascript. */ + + +// module myProjectName + +(function(){ + + // controller myCompanyName.myProjectName.samples.sample + + (function(){ + + abp.utils.createNamespace(window, 'myCompanyName.myProjectName.samples.sample'); + + myCompanyName.myProjectName.samples.sample.get = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/MyProjectName/sample', + type: 'GET' + }, ajaxParams)); + }; + + myCompanyName.myProjectName.samples.sample.getAuthorized = function(ajaxParams) { + return abp.ajax($.extend(true, { + url: abp.appPath + 'api/MyProjectName/sample/authorized', + type: 'GET' + }, ajaxParams)); + }; + + })(); + +})(); + +