Browse Source

Add static proxy file to module template

pull/10113/head
liangshiwei 4 years ago
parent
commit
a1bb05608a
  1. 1
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj
  2. 1
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyProjectNameIdentityServerModule.cs
  3. 6
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj
  4. 7
      templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyProjectNameWebUnifiedModule.cs
  5. 53
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/MyProjectName-generate-proxy.json
  6. 28
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.Generated.cs
  7. 8
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/ClientProxies/SampleClientProxy.cs
  8. 2
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi.Client/MyProjectNameHttpApiClientModule.cs
  9. 1
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.HttpApi/Samples/SampleController.cs
  10. 8
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/Pages/MyProjectName/Index.cshtml
  11. 32
      templates/module/aspnet-core/src/MyCompanyName.MyProjectName.Web/wwwroot/client-proxies/MyProjectName-proxy.js

1
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.IdentityServer/MyCompanyName.MyProjectName.IdentityServer.csproj

@ -28,6 +28,7 @@
<ProjectReference Include="..\..\..\..\..\framework\src\Volo.Abp.Swashbuckle\Volo.Abp.Swashbuckle.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Web.IdentityServer\Volo.Abp.Account.Web.IdentityServer.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.HttpApi\Volo.Abp.Account.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.Application\Volo.Abp.SettingManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.HttpApi\Volo.Abp.SettingManagement.HttpApi.csproj" />

1
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),

6
templates/module/aspnet-core/host/MyCompanyName.MyProjectName.Web.Unified/MyCompanyName.MyProjectName.Web.Unified.csproj

@ -24,23 +24,29 @@
<ProjectReference Include="..\..\..\..\..\modules\audit-logging\src\Volo.Abp.AuditLogging.EntityFrameworkCore\Volo.Abp.AuditLogging.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Web\Volo.Abp.Account.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.Application\Volo.Abp.Account.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\account\src\Volo.Abp.Account.HttpApi\Volo.Abp.Account.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\setting-management\src\Volo.Abp.SettingManagement.EntityFrameworkCore\Volo.Abp.SettingManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.Application\Volo.Abp.PermissionManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.HttpApi\Volo.Abp.PermissionManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\permission-management\src\Volo.Abp.PermissionManagement.EntityFrameworkCore\Volo.Abp.PermissionManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.Application\Volo.Abp.Identity.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.HttpApi\Volo.Abp.Identity.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.Web\Volo.Abp.Identity.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.Identity.EntityFrameworkCore\Volo.Abp.Identity.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\identity\src\Volo.Abp.PermissionManagement.Domain.Identity\Volo.Abp.PermissionManagement.Domain.Identity.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.EntityFrameworkCore\Volo.Abp.FeatureManagement.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Application\Volo.Abp.FeatureManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.HttpApi\Volo.Abp.FeatureManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\feature-management\src\Volo.Abp.FeatureManagement.Web\Volo.Abp.FeatureManagement.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Application\Volo.Abp.TenantManagement.Application.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.HttpApi\Volo.Abp.TenantManagement.HttpApi.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.Web\Volo.Abp.TenantManagement.Web.csproj" />
<ProjectReference Include="..\..\..\..\..\modules\tenant-management\src\Volo.Abp.TenantManagement.EntityFrameworkCore\Volo.Abp.TenantManagement.EntityFrameworkCore.csproj" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\MyCompanyName.MyProjectName.Application\MyCompanyName.MyProjectName.Application.csproj" />
<ProjectReference Include="..\..\src\MyCompanyName.MyProjectName.HttpApi\MyCompanyName.MyProjectName.HttpApi.csproj" />
<ProjectReference Include="..\..\src\MyCompanyName.MyProjectName.EntityFrameworkCore\MyCompanyName.MyProjectName.EntityFrameworkCore.csproj" />
<ProjectReference Include="..\..\src\MyCompanyName.MyProjectName.Web\MyCompanyName.MyProjectName.Web.csproj" />
<ProjectReference Include="..\MyCompanyName.MyProjectName.Host.Shared\MyCompanyName.MyProjectName.Host.Shared.csproj" />

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

53
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": {}
}

28
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>, ISampleAppService
{
public virtual async Task<SampleDto> GetAsync()
{
return await RequestAsync<SampleDto>(nameof(GetAsync));
}
public virtual async Task<SampleDto> GetAuthorizedAsync()
{
return await RequestAsync<SampleDto>(nameof(GetAuthorizedAsync));
}
}
}

8
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
{
}
}

2
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
);

1
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

8
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<MyProjectNameResource> L
@section scripts {
<abp-script-bundle name="@typeof(IndexModel).FullName">
<abp-script src="/client-proxies/MyProjectName-proxy.js" />
</abp-script-bundle>
}
@{
}
<h1>MyProjectName</h1>

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