Browse Source

generated proxies for public web application

pull/79/head
Galip Tolga Erdem 5 years ago
parent
commit
c07bb8c1d8
  1. 41
      apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/BasketClientProxy.Generated.cs
  2. 7
      apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/BasketClientProxy.cs
  3. 167
      apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/basket-generate-proxy.json
  4. 4
      apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml
  5. 9
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj
  6. 17
      apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

41
apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/BasketClientProxy.Generated.cs

@ -0,0 +1,41 @@
// 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 EShopOnAbp.BasketService.Services;
// ReSharper disable once CheckNamespace
namespace EShopOnAbp.BasketService.Services.ClientProxies;
[Dependency(ReplaceServices = true)]
[ExposeServices(typeof(IBasketAppService), typeof(BasketClientProxy))]
public partial class BasketClientProxy : ClientProxyBase<IBasketAppService>, IBasketAppService
{
public virtual async Task<BasketDto> GetAsync(Guid? anonymousUserId)
{
return await RequestAsync<BasketDto>(nameof(GetAsync), new ClientProxyRequestTypeValue
{
{ typeof(Guid?), anonymousUserId }
});
}
public virtual async Task<BasketDto> AddProductAsync(AddProductDto input)
{
return await RequestAsync<BasketDto>(nameof(AddProductAsync), new ClientProxyRequestTypeValue
{
{ typeof(AddProductDto), input }
});
}
public virtual async Task<BasketDto> RemoveProductAsync(RemoveProductDto input)
{
return await RequestAsync<BasketDto>(nameof(RemoveProductAsync), new ClientProxyRequestTypeValue
{
{ typeof(RemoveProductDto), input }
});
}
}

7
apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/BasketClientProxy.cs

@ -0,0 +1,7 @@
// This file is part of BasketClientProxy, you can customize it here
// ReSharper disable once CheckNamespace
namespace EShopOnAbp.BasketService.Services.ClientProxies;
public partial class BasketClientProxy
{
}

167
apps/public-web/src/EShopOnAbp.PublicWeb/ClientProxies/basket-generate-proxy.json

@ -0,0 +1,167 @@
{
"modules": {
"basket": {
"rootPath": "basket",
"remoteServiceName": "Basket",
"controllers": {
"EShopOnAbp.BasketService.Services.BasketAppService": {
"controllerName": "Basket",
"controllerGroupName": "Basket",
"type": "EShopOnAbp.BasketService.Services.BasketAppService",
"interfaces": [
{
"type": "Volo.Abp.Validation.IValidationEnabled"
},
{
"type": "Volo.Abp.Auditing.IAuditingEnabled"
},
{
"type": "Volo.Abp.GlobalFeatures.IGlobalFeatureCheckingEnabled"
},
{
"type": "EShopOnAbp.BasketService.Services.IBasketAppService"
}
],
"actions": {
"GetAsyncByAnonymousUserId": {
"uniqueName": "GetAsyncByAnonymousUserId",
"name": "GetAsync",
"httpMethod": "GET",
"url": "api/basket/basket",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "anonymousUserId",
"typeAsString": "System.Nullable`1[[System.Guid, System.Private.CoreLib, Version=6.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]], System.Private.CoreLib",
"type": "System.Guid?",
"typeSimple": "string?",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "anonymousUserId",
"name": "anonymousUserId",
"jsonName": null,
"type": "System.Guid?",
"typeSimple": "string?",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": ""
}
],
"returnValue": {
"type": "EShopOnAbp.BasketService.Services.BasketDto",
"typeSimple": "EShopOnAbp.BasketService.Services.BasketDto"
},
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.BasketService.Services.IBasketAppService"
},
"AddProductAsyncByInput": {
"uniqueName": "AddProductAsyncByInput",
"name": "AddProductAsync",
"httpMethod": "POST",
"url": "api/basket/basket/product",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "EShopOnAbp.BasketService.Services.AddProductDto, EShopOnAbp.BasketService.Contracts",
"type": "EShopOnAbp.BasketService.Services.AddProductDto",
"typeSimple": "EShopOnAbp.BasketService.Services.AddProductDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "input",
"jsonName": null,
"type": "EShopOnAbp.BasketService.Services.AddProductDto",
"typeSimple": "EShopOnAbp.BasketService.Services.AddProductDto",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "Body",
"descriptorName": ""
}
],
"returnValue": {
"type": "EShopOnAbp.BasketService.Services.BasketDto",
"typeSimple": "EShopOnAbp.BasketService.Services.BasketDto"
},
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.BasketService.Services.IBasketAppService"
},
"RemoveProductAsyncByInput": {
"uniqueName": "RemoveProductAsyncByInput",
"name": "RemoveProductAsync",
"httpMethod": "DELETE",
"url": "api/basket/basket/product",
"supportedVersions": [],
"parametersOnMethod": [
{
"name": "input",
"typeAsString": "EShopOnAbp.BasketService.Services.RemoveProductDto, EShopOnAbp.BasketService.Contracts",
"type": "EShopOnAbp.BasketService.Services.RemoveProductDto",
"typeSimple": "EShopOnAbp.BasketService.Services.RemoveProductDto",
"isOptional": false,
"defaultValue": null
}
],
"parameters": [
{
"nameOnMethod": "input",
"name": "ProductId",
"jsonName": null,
"type": "System.Guid",
"typeSimple": "string",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
},
{
"nameOnMethod": "input",
"name": "Count",
"jsonName": null,
"type": "System.Int32?",
"typeSimple": "number?",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
},
{
"nameOnMethod": "input",
"name": "AnonymousId",
"jsonName": null,
"type": "System.Guid?",
"typeSimple": "string?",
"isOptional": false,
"defaultValue": null,
"constraintTypes": null,
"bindingSourceId": "ModelBinding",
"descriptorName": "input"
}
],
"returnValue": {
"type": "EShopOnAbp.BasketService.Services.BasketDto",
"typeSimple": "EShopOnAbp.BasketService.Services.BasketDto"
},
"allowAnonymous": null,
"implementFrom": "EShopOnAbp.BasketService.Services.IBasketAppService"
}
}
}
}
}
},
"types": {}
}

4
apps/public-web/src/EShopOnAbp.PublicWeb/Components/Toolbar/Cart/Default.cshtml

@ -1,6 +1,6 @@
@using EShopOnAbp.BasketService.Localization
@using EShopOnAbp.Localization
@using Microsoft.AspNetCore.Mvc.Localization
@inject IHtmlLocalizer<BasketServiceResource> L
@inject IHtmlLocalizer<EShopOnAbpResource> L
@model EShopOnAbp.BasketService.Services.BasketDto
<div id="shopping-cart" class="nav-link">

9
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbp.PublicWeb.csproj

@ -39,6 +39,11 @@
</Content>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="**\*generate-proxy.json" />
<Content Remove="**\*generate-proxy.json" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Logs\**" />
<Content Remove="Logs\**" />
@ -46,4 +51,8 @@
<None Remove="Logs\**" />
</ItemGroup>
<ItemGroup>
<_ContentIncludedByDefault Remove="ClientProxies\app-generate-proxy.json" />
</ItemGroup>
</Project>

17
apps/public-web/src/EShopOnAbp.PublicWeb/EShopOnAbpPublicWebModule.cs

@ -40,6 +40,7 @@ using EShopOnAbp.PublicWeb.PaymentMethods;
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.AnonymousUser;
using Microsoft.Extensions.Configuration;
using Volo.Abp.VirtualFileSystem;
namespace EShopOnAbp.PublicWeb;
@ -54,7 +55,7 @@ namespace EShopOnAbp.PublicWeb;
typeof(EShopOnAbpSharedHostingAspNetCoreModule),
typeof(EShopOnAbpSharedLocalizationModule),
typeof(CatalogServiceHttpApiClientModule),
// typeof(BasketServiceModule),
typeof(BasketServiceContractsModule),
typeof(OrderingServiceHttpApiClientModule),
typeof(AbpAspNetCoreSignalRModule),
typeof(PaymentServiceHttpApiClientModule),
@ -79,6 +80,8 @@ public class EShopOnAbpPublicWebModule : AbpModule
var hostingEnvironment = context.Services.GetHostingEnvironment();
var configuration = context.Services.GetConfiguration();
ConfigureBasketHttpClient(context);
context.Services.AddAutoMapperObjectMapper<EShopOnAbpPublicWebModule>();
Configure<AbpAutoMapperOptions>(options => { options.AddMaps<EShopOnAbpPublicWebModule>(validate: true); });
@ -159,6 +162,18 @@ public class EShopOnAbpPublicWebModule : AbpModule
});
}
private void ConfigureBasketHttpClient(ServiceConfigurationContext context)
{
context.Services.AddStaticHttpClientProxies(
typeof(BasketServiceContractsModule).Assembly, remoteServiceConfigurationName: BasketServiceConstants.RemoteServiceName
);
Configure<AbpVirtualFileSystemOptions>(options =>
{
options.FileSets.AddEmbedded<EShopOnAbpPublicWebModule>();
});
}
private void ConfigurePayment(IConfiguration configuration)
{
Configure<EShopOnAbpPublicWebPaymentOptions>(options =>

Loading…
Cancel
Save