Skip to content

Commit

Permalink
Merge pull request #248 from abpframework/aspire
Browse files Browse the repository at this point in the history
Introduce .Net Aspire
  • Loading branch information
skoc10 authored May 23, 2024
2 parents ccb8777 + d98fe66 commit 5c16491
Show file tree
Hide file tree
Showing 136 changed files with 3,794 additions and 50,560 deletions.
227 changes: 121 additions & 106 deletions EShopOnAbp.sln

Large diffs are not rendered by default.

20 changes: 10 additions & 10 deletions apps/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@
},
"private": true,
"dependencies": {
"@abp/ng.account": "~8.0.0",
"@abp/ng.components": "~8.0.0",
"@abp/ng.core": "~8.0.0",
"@abp/ng.identity": "~8.0.0",
"@abp/ng.oauth": "~8.0.0",
"@abp/ng.setting-management": "~8.0.0",
"@abp/ng.tenant-management": "~8.0.0",
"@abp/ng.theme.basic": "~8.0.0",
"@abp/ng.account": "^8.1.3",
"@abp/ng.components": "^8.1.3",
"@abp/ng.core": "^8.1.3",
"@abp/ng.identity": "^8.1.3",
"@abp/ng.oauth": "^8.1.3",
"@abp/ng.setting-management": "^8.1.3",
"@abp/ng.tenant-management": "^8.1.3",
"@abp/ng.theme.basic": "^8.1.3",
"@abp/ng.theme.lepton-x": "~3.0.0",
"@abp/ng.theme.shared": "~8.0.0",
"@abp/ng.theme.shared": "^8.1.3",
"@angular/animations": "~17.0.0",
"@angular/common": "~17.0.0",
"@angular/compiler": "~17.0.0",
Expand All @@ -36,7 +36,7 @@
"zone.js": "~0.14.2"
},
"devDependencies": {
"@abp/ng.schematics": "~8.0.0",
"@abp/ng.schematics": "^8.1.3",
"@angular-devkit/build-angular": "~17.0.0",
"@angular/cli": "~17.0.0",
"@angular/compiler-cli": "~17.0.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
@using EShopOnAbp.Localization
@using EShopOnAbp.PublicWeb.Components.Purchase
@using Microsoft.Extensions.Localization
@using Microsoft.Extensions.Options
@using Volo.Abp.Http.Client
@model EShopOnAbp.BasketService.Services.BasketDto
@inject IStringLocalizer<EShopOnAbpResource> L
@inject IOptions<AbpRemoteServiceOptions> options

<div>
@if (!Model.Items.Any())
Expand Down Expand Up @@ -34,7 +31,7 @@
<div class="basket-list flex-container vertical">
@foreach (var item in Model.Items)
{
string imageName = item.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/noimage.jpg" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{item.ImageName}";
string imageName = item.ImageName.IsNullOrEmpty() ? $"product-images/noimage.jpg" : $"product-images/{item.ImageName}";
var price = item.TotalPrice.ToString("0.00");
<div class="card basket-list-item" data-product-id="@item.ProductId">
<div class="card-body">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
{
foreach (var item in Model.Items)
{
string imageName = item.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/noimage.jpg" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{item.ImageName}";
string imageName = item.ImageName.IsNullOrEmpty() ? $"product-images/noimage.jpg" : $"product-images/{item.ImageName}";
var price = item.TotalPrice.ToString("0.00");
<div class="dropdown-item">

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<abp-column size="_2">
<a href="/products/@item.ProductId.ToString()">
@{
string imageUrl = $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{item.PictureUrl}";
string imageUrl = $"product-images/{item.PictureUrl}";
<img class="img-size" src="@imageUrl" />
}
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.0" />
<PackageReference Include="Microsoft.AspNetCore.DataProtection.StackExchangeRedis" Version="8.0.5" />
<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="8.0.0" />
<PackageReference Include="Volo.CmsKit.Public.Web" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AutoMapper" Version="8.1.3" />
<PackageReference Include="Volo.CmsKit.Public.Web" Version="8.1.3" />
<PackageReference Include="Yarp.ReverseProxy" Version="2.1.0" />
<PackageReference Include="Microsoft.Extensions.ServiceDiscovery.Yarp" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.0.0" />
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="8.0.0" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel.Web" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.OpenIdConnect" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.Client" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.0.0-*" />
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="8.0.0" />
<PackageReference Include="Volo.Abp.AspNetCore.SignalR" Version="8.0.0" />
<PackageReference Include="Volo.Abp.Caching.StackExchangeRedis" Version="8.1.3" />
<PackageReference Include="Volo.Abp.EventBus.RabbitMQ" Version="8.1.3" />
<PackageReference Include="Volo.Abp.Http.Client.IdentityModel.Web" Version="8.1.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Authentication.OpenIdConnect" Version="8.1.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.Client" Version="8.1.3" />
<PackageReference Include="Volo.Abp.AspNetCore.Mvc.UI.Theme.LeptonXLite" Version="3.1.0-*" />
<PackageReference Include="Volo.Abp.Account.HttpApi.Client" Version="8.1.3" />
<PackageReference Include="Volo.Abp.AspNetCore.SignalR" Version="8.1.3" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\..\..\aspire\ServiceDefaults\eShopOnAbp.ServiceDefaults.csproj" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using EShopOnAbp.OrderingService;
using EShopOnAbp.PaymentService;
using EShopOnAbp.PaymentService.PaymentMethods;
using EShopOnAbp.PublicWeb.AnonymousUser;
using EShopOnAbp.PublicWeb.Components.Toolbar.Cart;
using EShopOnAbp.PublicWeb.Menus;
using EShopOnAbp.PublicWeb.PaymentMethods;
Expand All @@ -22,7 +21,6 @@
using Polly;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Security.Claims;
Expand Down Expand Up @@ -56,7 +54,6 @@
using Volo.Abp.UI.Navigation;
using Volo.Abp.UI.Navigation.Urls;
using Volo.Abp.VirtualFileSystem;
using Volo.CmsKit;
using Volo.CmsKit.Public.Web;
using Yarp.ReverseProxy.Transforms;

Expand Down Expand Up @@ -113,6 +110,8 @@ public override void ConfigureServices(ServiceConfigurationContext context)
{
Microsoft.IdentityModel.Logging.IdentityModelEventSource.ShowPII = true;
var configuration = context.Services.GetConfiguration();

context.Services.AddHttpForwarderWithServiceDiscovery();

ConfigureBasketHttpClient(context);

Expand Down Expand Up @@ -312,15 +311,14 @@ public override void OnApplicationInitialization(ApplicationInitializationContex
app.UseCorrelationId();
app.UseStaticFiles();
app.UseRouting();
// app.UseHttpMetrics();
app.UseAuthentication();
app.UseAbpSerilogEnrichers();
app.UseAuthorization();
// app.UseAnonymousUser();
app.UseConfiguredEndpoints(endpoints =>
{
endpoints.MapReverseProxy();
// endpoints.MapMetrics();
endpoints.MapForwarder("*/product-images/{name}", "http://_http.catalogService/product-images", "/{name}");
endpoints.MapForwarder("/products/product-images/{name}", "http://_http.catalogService/product-images", "/{name}");
});
}

Expand Down
6 changes: 1 addition & 5 deletions apps/public-web/src/EShopOnAbp.PublicWeb/Pages/Index.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@
@using EShopOnAbp.Localization
@using Microsoft.Extensions.Localization
@using System.Globalization
@using Microsoft.Extensions.Options
@using Volo.Abp.Http.Client
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating
@model EShopOnAbp.PublicWeb.Pages.IndexModel
@inject IStringLocalizer<EShopOnAbpResource> L
@inject IOptions<AbpRemoteServiceOptions> options

@{
string pageHeader = L["OurProducts"];
Expand All @@ -34,7 +30,7 @@
@foreach (var product in Model.Products)
{
var productPrice = product.Price.ToString("C", new CultureInfo("en-US"));
string productImage = !product.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{product.ImageName}" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/@product.ImageName";
string productImage = !product.ImageName.IsNullOrEmpty() ? $"product-images/{product.ImageName}" : $"product-images/@product.ImageName";
string buyText = L["Index:AddToBasket"];
<div class="product-container">
<div class="product-list-item" data-product-id="@product.Id.ToString()">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,12 @@
@using EShopOnAbp.Localization
@using Microsoft.Extensions.Localization
@using System.Globalization
@using Microsoft.Extensions.Options
@using Volo.Abp.GlobalFeatures
@using Volo.Abp.Http.Client
@using Volo.CmsKit.GlobalFeatures
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Commenting
@using Volo.CmsKit.Public.Web.Pages.CmsKit.Shared.Components.Rating

@inject IStringLocalizer<EShopOnAbpResource> L
@inject IOptions<AbpRemoteServiceOptions> options

@model EShopOnAbp.PublicWeb.Pages.ProductDetailModel

Expand All @@ -32,7 +29,7 @@
@{
var product = Model.Product;
var productPrice = product.Price.ToString("C", new CultureInfo("en-US"));
string productImage = !product.ImageName.IsNullOrEmpty() ? $"{options.Value.RemoteServices.Default.BaseUrl}product-images/{product.ImageName}" : $"{options.Value.RemoteServices.Default.BaseUrl}product-images/@product.ImageName";
string productImage = !product.ImageName.IsNullOrEmpty() ? $"product-images/{product.ImageName}" : $"product-images/@product.ImageName";
string buyText = L["Index:AddToBasket"];
<div class="product-list-item" data-product-id="@product.Id.ToString()">
<a href="/products/@product.Id.ToString()">
Expand Down Expand Up @@ -74,14 +71,14 @@
<abp-column size-md="_6">
@if (GlobalFeatureManager.Instance.IsEnabled<RatingsFeature>() && Model.IsPurschased)
{
@await Component.InvokeAsync(typeof(RatingViewComponent), new { entityType = "quote", entityId = @product.Id.ToString() })
@await Component.InvokeAsync(typeof(RatingViewComponent), new { entityType = "quote", entityId = @product.Id.ToString(), isReadOnly = false })
}
</abp-column>
<abp-column size-md="_12">
@* Need read-only commenting system *@
@if (GlobalFeatureManager.Instance.IsEnabled<CommentsFeature>() && Model.IsPurschased)
{
@await Component.InvokeAsync(typeof(CommentingViewComponent), new { entityType = "quote", entityId = @product.Id.ToString() })
@await Component.InvokeAsync(typeof(CommentingViewComponent), new { entityType = "quote", entityId = @product.Id.ToString(), isReadOnly = true })
}
</abp-column>
</abp-row>
Expand Down
14 changes: 12 additions & 2 deletions apps/public-web/src/EShopOnAbp.PublicWeb/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using System.Threading.Tasks;
using EShopOnAbp.Shared.Hosting.AspNetCore;
using Microsoft.AspNetCore.Builder;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Serilog;

namespace EShopOnAbp.PublicWeb;
Expand All @@ -17,7 +19,15 @@ public static async Task<int> Main(string[] args)
try
{
Log.Information($"Starting {assemblyName}.");
var app = await ApplicationBuilderHelper.BuildApplicationAsync<EShopOnAbpPublicWebModule>(args);
var builder = WebApplication.CreateBuilder(args);
builder.Host
.UseAutofac()
.UseSerilog();

builder.AddServiceDefaults();

await builder.AddApplicationAsync<EShopOnAbpPublicWebModule>();
var app = builder.Build();
await app.InitializeApplicationAsync();
await app.RunAsync();

Expand All @@ -30,7 +40,7 @@ public static async Task<int> Main(string[] args)
}
finally
{
Log.CloseAndFlush();
await Log.CloseAndFlushAsync();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,25 +1,20 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44335",
"sslPort": 44335
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"http": {
"commandName": "Project",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "http://localhost:5035",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"EShopOnAbp.PublicWeb": {
"https": {
"commandName": "Project",
"dotnetRunMessages": "true",
"dotnetRunMessages": true,
"launchBrowser": true,
"applicationUrl": "https://localhost:44335",
"applicationUrl": "http://localhost:5035;https://localhost:44335",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
Expand Down
4 changes: 2 additions & 2 deletions apps/public-web/src/EShopOnAbp.PublicWeb/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"AllowedHosts": "*",
"RemoteServices": {
"Default": {
"BaseUrl": "https://localhost:44373/",
"BaseUrl": "http://webPublicGateway/",
"UseCurrentAccessToken": "false"
}
},
Expand Down Expand Up @@ -56,7 +56,7 @@
"cluster1": {
"Destinations": {
"destination1": {
"Address": "https://localhost:44373/"
"Address": "http://webPublicGateway"
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions apps/public-web/src/EShopOnAbp.PublicWeb/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"private": true,
"dependencies": {
"@abp/aspnetcore.mvc.ui.theme.leptonxlite": "~3.0.0",
"@abp/signalr": "^8.0.0",
"@abp/cms-kit": "^8.0.0"
"@abp/signalr": "^8.1.3",
"@abp/cms-kit": "^8.1.3"
}
}
Loading

0 comments on commit 5c16491

Please sign in to comment.