Compare commits

..

2 Commits

5 changed files with 137 additions and 26 deletions

View File

@ -0,0 +1,18 @@
//using AyCode.Core.Consts;
//using Mango.Nop.Core;
namespace Nop.Plugin.Misc.FruitBankPlugin
{
//public class FruitBankConst : NopCommonConst
//{
// public static string ProjectIdString = "f9f9383f-c459-4b9f-b0b5-201bd4a9c21b";
// public const string RequiresMeasurementAttr = "PriceByMeasurement.RequiresMeasurement";
// static FruitBankConst()
// {
// ProjectId = Guid.Parse(ProjectIdString);
// ProjectSalt = GenerateProjectSalt(ProjectId.ToString("N"));
// }
//}
}

View File

@ -1,14 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Nop.Plugin.Misc.FruitBankPlugin
{
public static class FruitBankConsts
{
public const string RequiresMeasurementAttr = "PriceByMeasurement.RequiresMeasurement";
}
}

View File

@ -1,4 +1,11 @@
using Microsoft.AspNetCore.Builder;
//using AyCode.Core.Loggers;
using AyCode.Core.Loggers;
using FruitBank.Common;
using FruitBank.Common.Server.Controllers;
using FruitBank.Common.Server.Services.Loggers;
using FruitBank.Common.Server.Services.SignalRs;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Mvc.Razor;
using Microsoft.AspNetCore.SignalR;
using Microsoft.Extensions.Configuration;
@ -34,9 +41,15 @@ public class PluginNopStartup : INopStartup
// .AllowCredentials()
// ));
services.AddSignalR();
services.AddSignalR(options => options.MaximumReceiveMessageSize = 256 * 1024);
//register services and interfaces
services.AddSingleton<LoggerToLoggerApiController>();
services.AddSingleton<IAcLogWriterBase, ConsoleLogWriter>();
//services.AddSingleton<SessionService>();
services.AddScoped<FruitBankDataController>();
//services.AddScoped<CustomModelFactory, ICustomerModelFactory>();
services.AddScoped<IPriceCalculationService, CustomPriceCalculationService>();
services.AddScoped<PriceCalculationService, CustomPriceCalculationService>();
@ -54,17 +67,24 @@ public class PluginNopStartup : INopStartup
/// <param name="application">Builder for configuring an application's request pipeline</param>
public void Configure(IApplicationBuilder application)
{
application.UseWhen(context => context.Request.Path.StartsWithSegments("/fbhub"), app =>
var fruitBankHubEndPoint = $"/{FruitBankConstClient.DefaultHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(fruitBankHubEndPoint), app =>
{
//app.UseCors("AllowBlazorClient");
//app.UseRouting();
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<FruitBankHub>("/fbhub");
endpoints.MapHub<DevAdminSignalRHub>(fruitBankHubEndPoint);
});
});
var loggrHubEndPoint = $"/{FruitBankConstClient.LoggerHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(loggrHubEndPoint), app =>
{
app.UseEndpoints(endpoints =>
{
endpoints.MapHub<LoggerSignalRHub>(loggrHubEndPoint);
});
});
}
/// <summary>

View File

@ -9,6 +9,7 @@
to ensure that the dlls copied from the NuGet cache to the output of your project-->
<CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
<ImplicitUsings>enable</ImplicitUsings>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
</PropertyGroup>
<ItemGroup>
@ -41,6 +42,8 @@
<ItemGroup>
<ProjectReference Include="$(SolutionDir)\Presentation\Nop.Web\Nop.Web.csproj" />
<ProjectReference Include="..\..\Libraries\Mango.Nop.Core\Mango.Nop.Core.csproj" />
<ProjectReference Include="..\..\Libraries\Mango.Nop.Services\Mango.Nop.Services.csproj" />
<ClearPluginAssemblies Include="$(SolutionDir)\Build\ClearPluginAssemblies.proj" />
</ItemGroup>
@ -55,6 +58,77 @@
<Folder Include="Validators\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.SignalR.Common" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.Json" Version="9.0.8" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="9.0.8" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="9.0.8" />
<PackageReference Include="SendGrid" Version="9.29.3" />
</ItemGroup>
<ItemGroup>
<Reference Include="AyCode.Core">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Core.dll</HintPath>
</Reference>
<Reference Include="AyCode.Core.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Core.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Database">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Database.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Entities.dll</HintPath>
</Reference>
<Reference Include="AyCode.Entities.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Entities.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Interfaces.dll</HintPath>
</Reference>
<Reference Include="AyCode.Interfaces.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Interfaces.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Models.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Models.Server.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Services.dll</HintPath>
</Reference>
<Reference Include="AyCode.Services.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\AyCode.Services.Server.dll</HintPath>
</Reference>
<Reference Include="FruitBank.Common">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\FruitBank.Common.dll</HintPath>
</Reference>
<Reference Include="FruitBank.Common.Server">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\FruitBank.Common.Server.dll</HintPath>
</Reference>
<Reference Include="MessagePack">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\MessagePack.dll</HintPath>
</Reference>
<Reference Include="MessagePack.Annotations">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\MessagePack.Annotations.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.Http.Connections.Client">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Microsoft.AspNetCore.Http.Connections.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Client">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Microsoft.AspNetCore.SignalR.Client.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Client.Core">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Microsoft.AspNetCore.SignalR.Client.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson.dll</HintPath>
</Reference>
<Reference Include="Microsoft.NET.StringTools">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Microsoft.NET.StringTools.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json">
<HintPath>..\..\..\..\FruitBankHybridApp\FruitBank.Common.Server\bin\Debug\net9.0\Newtonsoft.Json.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<None Update="Areas\Admin\Views\Configure\Configure.cshtml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>

View File

@ -41,16 +41,29 @@ public class PluginNopStartup : INopStartup
public void Configure(IApplicationBuilder application)
{
application.UseWhen(context => context.Request.Path.StartsWithSegments("/fbhub"), app =>
//application.UseWhen(context => context.Request.Path.StartsWithSegments("/fbhub"), app =>
//{
// app.UseCors("AllowBlazorClient");
// app.UseRouting();
// //app.UseEndpoints(endpoints =>
// //{
// // endpoints.MapHub<FruitBankHub>("/fbhub");
// //});
//});
var fruitBankHubEndPoint = "/fbHub";// $"/{FruitBankConstClient.DefaultHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(fruitBankHubEndPoint), app =>
{
app.UseCors("AllowBlazorClient");
app.UseRouting();
//app.UseEndpoints(endpoints =>
//{
// endpoints.MapHub<FruitBankHub>("/fbhub");
//});
});
var loggrHubEndPoint = "/loggerHub";//$"/{FruitBankConstClient.LoggerHubName}";
application.UseWhen(context => context.Request.Path.StartsWithSegments(loggrHubEndPoint), app =>
{
app.UseCors("AllowBlazorClient");
app.UseRouting();
});
}
/// <summary>