Added Newtonsoft JSON.

Added input formatter for Cart saving.
Added preload for INV, Customers.
Added System Text Json.
Added ANC Newstonsoft integration.
Added Debug/Release Switch for libraries.
Added HtmlFactory
This commit is contained in:
Cameron Taylor 2023-05-18 15:16:14 -04:00
parent 6466d17905
commit 1a71f4bd71
2 changed files with 75 additions and 14 deletions

View File

@ -1,18 +1,32 @@
using CVRLIB.CVENVIRONMENT;
using static CVRLIB.CVGlobal;
using CA_ANC.Formatters;
using CVRLIB;
using CVRLIB.Inventory;
using CVRLIB.Customers;
//ZXING.dll does not copy properly to publish folder, copy manually from another lib, ie cvrlib-nf.
var builder = WebApplication.CreateBuilder(args);
// Add services to the container.
builder.Services.AddRazorPages();
builder.Services.AddControllers().AddJsonOptions((options => {
//was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
options.JsonSerializerOptions.PropertyNamingPolicy = null;
}));
//builder.Services.AddControllers().AddJsonOptions((options => {
// //was changing PRINTER_NAME to printeR_NAME (pascal Case: https://github.com/dotnet/runtime/issues/30887)
// options.JsonSerializerOptions.PropertyNamingPolicy = null;
//}));
builder.Services
.AddControllers(options => { options.InputFormatters.Add(new ByteArrayInputFormatter()); })
.AddNewtonsoftJson()
;
var app = builder.Build();
@ -27,6 +41,14 @@ if (!app.Environment.IsDevelopment()) {
VSERVERWS.Global.Globals.IsDevelopment = app.Environment.IsDevelopment();
VSERVERWS.Global.Globals.LoadPrinters();
CVGlobal.TryGlobalPRELoadCVCollections(new[] { typeof(CVINVENTORY), typeof(CVCustomers) });
app.UseHttpsRedirection();
app.UseStaticFiles();
@ -42,4 +64,19 @@ app.MapRazorPages();
app.Run();
VSERVERWS.Global.Globals.LoadPrinters();
public partial class Program {
public static CVSECRETS? CVS { get; set; } = null;
public static string AppPath { get; set; } = "";
public static string HTTPROOT { get; set; } = "";
public static bool IsDevMode { get; set; } = false;
}

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0-windows</TargetFramework>
@ -9,19 +9,43 @@
<ItemGroup>
<PackageReference Include="Magick.NET-Q8-AnyCPU" Version="11.3.0" />
<PackageReference Include="Magick.NET.Core" Version="11.3.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="6.0.16" />
<PackageReference Include="Microsoft.Windows.Compatibility" Version="6.0.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.8.5" />
<PackageReference Include="System.Text.Json" Version="7.0.2" />
<PackageReference Include="ZXing.Net" Version="0.16.8" />
<FrameworkReference Include="Microsoft.WindowsDesktop.App" />
</ItemGroup>
<ItemGroup>
<Reference Include="CVRLIB">
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Release\netstandard2.0\CVRLIB.dll</HintPath>
</Reference>
<Reference Include="CVRLIB-NF">
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Release\CVRLIB-NF.dll</HintPath>
</Reference>
</ItemGroup>
<Choose>
<When Condition=" '$(Configuration)'=='Debug' ">
<ItemGroup>
<Reference Include="CVRLIB">
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Debug\netstandard2.0\CVRLIB.dll</HintPath>
</Reference>
<Reference Include="CVRLIB-NF">
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Debug\CVRLIB-NF.dll</HintPath>
</Reference>
<Reference Include="HtmlFactory">
<HintPath>..\HtmlFactory\HtmlFactory\bin\Debug\netstandard2.0\HtmlFactory.dll</HintPath>
</Reference>
</ItemGroup>
</When>
<When Condition=" '$(Configuration)'=='Release' ">
<ItemGroup>
<Reference Include="CVRLIB">
<HintPath>..\..\VB.NET\CVRLIB\CVRLIB\bin\Release\netstandard2.0\CVRLIB.dll</HintPath>
</Reference>
<Reference Include="CVRLIB-NF">
<HintPath>..\..\VB.NET\CVRLIB-NF\CVRLIB-NF\bin\Release\CVRLIB-NF.dll</HintPath>
</Reference>
<Reference Include="HtmlFactory">
<HintPath>..\HtmlFactory\HtmlFactory\bin\Release\netstandard2.0\HtmlFactory.dll</HintPath>
</Reference>
</ItemGroup>
</When>
</Choose>
</Project>