Enable source-generated binary serialization & AOT

Added AcBinarySerializable and ToonDescription to DTOs/entities for source-generated serialization. Enabled AOT compilation for Blazor/WebAssembly projects. Integrated AyCode.Core.Serializers.SourceGenerator as analyzer. Updated solution and project files, improved entity metadata, and adjusted imports. Commented out InitializeComponent in WinUI App for startup handling.
This commit is contained in:
Loretta 2026-03-07 14:05:39 +01:00
parent 1b68599acc
commit 5bd5e14953
24 changed files with 76 additions and 32 deletions

View File

@ -1,10 +1,12 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using Mango.Nop.Core.Dtos;
using Nop.Core.Domain.Common;
using Nop.Core.Domain.Orders;
namespace FruitBank.Common.Dtos;
[AcBinarySerializable(false, true, false, true)]
[LinqToDB.Mapping.Table(Name = nameof(GenericAttribute))]
[System.ComponentModel.DataAnnotations.Schema.Table(nameof(GenericAttribute))]
[ToonDescription($"Data transfer object for {nameof(GenericAttribute)}", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(GenericAttribute)])]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Extensions;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Utils.Extensions;
using FruitBank.Common.Entities;
@ -21,6 +22,7 @@ using System.Linq.Expressions;
namespace FruitBank.Common.Dtos;
[AcBinarySerializable(false, true, false, true)]
[LinqToDB.Mapping.Table(Name = nameof(Order))]
[System.ComponentModel.DataAnnotations.Schema.Table(nameof(Order))]
[ToonDescription($"Data transfer object for {nameof(Order)}", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(Order)])]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Entities;
using FruitBank.Common.Enums;
using FruitBank.Common.Interfaces;
@ -15,6 +16,7 @@ using System.Linq.Expressions;
namespace FruitBank.Common.Dtos;
[AcBinarySerializable(false, true, false, true)]
[LinqToDB.Mapping.Table(Name = nameof(OrderItem))]
[System.ComponentModel.DataAnnotations.Schema.Table(nameof(OrderItem))]
[ToonDescription("Order item with measurements, pallets, and validation", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(OrderItem)])]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Dtos;
@ -15,6 +16,7 @@ using System.Linq.Expressions;
namespace FruitBank.Common.Dtos;
[AcBinarySerializable(false, true, false, true)]
[LinqToDB.Mapping.Table(Name = nameof(Product))]
[System.ComponentModel.DataAnnotations.Schema.Table(nameof(Product))]
[ToonDescription("Product data with measurements and generic attributes", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(Product)])]

View File

@ -1,3 +1,4 @@
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
@ -13,9 +14,11 @@ using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FruitBank.Common.Entities;
namespace FruitBank.Common.Dtos
{
[AcBinarySerializable(false, true, false, true)]
[LinqToDB.Mapping.Table(Name = nameof(StockQuantityHistory))]
[System.ComponentModel.DataAnnotations.Schema.Table(nameof(StockQuantityHistory))]
[ToonDescription("Stock quantity history with net weight adjustments", TypeRelation = ToonTypeRelation.DtoOf, RelatedTypes = [typeof(StockQuantityHistory)])]

View File

@ -1,10 +1,12 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Uploaded file with extracted text content", Purpose = "A centralized repository for all uploaded binary content and metadata, featuring a 'RawText' field that stores OCR-extracted information for full-text search and automated data validation across the system")]
[Table(Name = FruitBankConstClient.FilesDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.FilesDbTableName)]

View File

@ -1,3 +1,4 @@
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Dtos;
using FruitBank.Common.Enums;

View File

@ -1,3 +1,4 @@
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Dtos;
using FruitBank.Common.Enums;
@ -11,6 +12,7 @@ using Table = LinqToDB.Mapping.TableAttribute;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Pallet measurements for order items with audit tracking", Purpose = "A measurement record for outgoing goods, used to verify that the net weight being sent to the customer is accurate and audited. NOTE: Despite the 'Pallet' name, this is a general measurement record that is ALWAYS created for every item. If the product is not measurable (IsMeasurable=false), weights are recorded as 0.0 and only TrayQuantity is stored.")]
[Table(Name = FruitBankConstClient.OrderItemPalletDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.OrderItemPalletDbTableName)]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB;
using LinqToDB.Mapping;
@ -6,6 +7,7 @@ using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Pallet type definition with size and weight")]
[Table(Name = FruitBankConstClient.PalletDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.PalletDbTableName)]

View File

@ -1,10 +1,12 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Business partner with address and tax information", Purpose = "Represents an external legal entity, specifically a Supplier who provides goods or a business partner involved in the procurement chain")]
[Table(Name = FruitBankConstClient.PartnerDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.PartnerDbTableName)]

View File

@ -1,11 +1,13 @@
using AyCode.Interfaces.EntityComment;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Interfaces.EntityComment;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Shipping record with documents and measurement tracking", Purpose = "Represents a physical inbound delivery event (truck arrival) at the warehouse, tracking the vehicle and the overall measurement status of the shipment")]
[Table(Name = FruitBankConstClient.ShippingDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDbTableName)]

View File

@ -1,11 +1,13 @@
using System.Collections.ObjectModel;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using System.Collections.ObjectModel;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Shipping document with partner, items and files", Purpose = "A digital representation of a supplier's delivery note or invoice associated with the shipment, used for reconciling paper-based data with measured reality")]
[Table(Name = FruitBankConstClient.ShippingDocumentDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDocumentDbTableName)]

View File

@ -1,12 +1,14 @@
using System.ComponentModel.DataAnnotations.Schema;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Links shipping documents to files with document type", Purpose = "A many-to-many link table that associates general uploaded files with specific shipping documents, assigning a functional context (DocumentType) to each file, such as identifying which PDF is the supplier's invoice versus the packing list")]
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.ShippingDocumentToFilesDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingDocumentToFilesDbTableName)]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Interfaces;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Dtos;
using FruitBank.Common.Enums;
@ -11,13 +12,14 @@ using Nop.Core.Domain.Customers;
using Nop.Core.Domain.Orders;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Column = LinqToDB.Mapping.ColumnAttribute;
//using Nop.Core.Domain.Catalog;
using DataType = LinqToDB.DataType;
using Column = LinqToDB.Mapping.ColumnAttribute;
using Table = LinqToDB.Mapping.TableAttribute;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Shipping document item with measurements and pallets", Purpose = "Represents a specific product line item within a shipping document, storing the discrepancy between the supplier's declared weight/quantity and the warehouse's measured values")]
[Table(Name = FruitBankConstClient.ShippingItemDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingItemDbTableName)]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
using System.ComponentModel.DataAnnotations;
@ -7,6 +8,7 @@ using System.Security.Cryptography.X509Certificates;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Pallet measurements for shipping items", Purpose = "The smallest unit of measurement tracking, representing a single physical measurement event. NOTE: Technically named 'Pallet' for legacy reasons, but it is ALWAYS created even if goods arrive without a physical pallet. For non-measurable products, weights are 0.0 and only TrayQuantity is tracked for tare-weight calculations.")]
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.ShippingItemPalletDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.ShippingItemPalletDbTableName)]

View File

@ -1,18 +1,11 @@
using AyCode.Interfaces.Entities;
using AyCode.Interfaces.TimeStampInfo;
using FruitBank.Common;
using FruitBank.Common.Interfaces;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using AyCode.Interfaces.Entities;
using LinqToDB;
using LinqToDB.Mapping;
using Nop.Core.Domain.Catalog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AyCode.Core.Serializers.Toons;
using Mango.Nop.Core.Entities;
namespace Mango.Nop.Core.Entities
namespace FruitBank.Common.Entities
{
public interface IStockQuantityHistoryExt : IEntityInt
{
@ -22,6 +15,7 @@ namespace Mango.Nop.Core.Entities
public bool IsInconsistent { get; set; }
}
[AcBinarySerializable(false, true, false, true)]
[Table(Name = FruitBankConstClient.StockQuantityHistoryExtDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockQuantityHistoryExtDbTableName)]
[ToonDescription("Extended weight-metadata for StockQuantityHistory", Purpose = "Validates quantity deltas against measured weight to detect inconsistencies")]

View File

@ -1,9 +1,11 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Inventory session record", Purpose = "Orchestrates inventory sessions by freezing logical stock states")]
[Table(Name = FruitBankConstClient.StockTakingDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockTakingDbTableName)]

View File

@ -1,15 +1,17 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Dtos;
using LinqToDB;
using LinqToDB.Mapping;
using Mango.Nop.Core.Entities;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations.Schema;
using Column = LinqToDB.Mapping.ColumnAttribute;
using Table = LinqToDB.Mapping.TableAttribute;
namespace FruitBank.Common.Entities;
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Line item for product reconciliation", Purpose = "Reconciles snapshot quantity with physical count to calculate final stock delta")]
[Table(Name = FruitBankConstClient.StockTakingItemDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockTakingItemDbTableName)]

View File

@ -1,4 +1,5 @@
using AyCode.Core.Serializers.Toons;
using AyCode.Core.Serializers.Attributes;
using AyCode.Core.Serializers.Toons;
using FruitBank.Common.Dtos;
using FruitBank.Common.Interfaces;
using LinqToDB.Mapping;
@ -13,6 +14,7 @@ public interface IStockTakingItemPallet : IMeasuringItemPalletBase
public StockTakingItem? StockTakingItem{ get; set; }
}
[AcBinarySerializable(false, true, false, true)]
[ToonDescription("Weight record for inventory item", Purpose = "Granular weight-based evidence for a stock taking line item. NOTE: This record is mandatory for every inventory item. If weighing is skipped (non-measurable), it serves as a container for TrayQuantity with zeroed weight fields. The term 'Pallet' is a legacy naming convention.")]
[LinqToDB.Mapping.Table(Name = FruitBankConstClient.StockTakingItemPalletDbTableName)]
[System.ComponentModel.DataAnnotations.Schema.Table(FruitBankConstClient.StockTakingItemPalletDbTableName)]

View File

@ -3,8 +3,9 @@
<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<EmitCompilerGeneratedFiles>false</EmitCompilerGeneratedFiles>
</PropertyGroup>
<ItemGroup>
@ -37,6 +38,12 @@
<Reference Include="Mango.Nop.Core">
<HintPath>..\..\NopCommerce.Common\4.70\Libraries\Mango.Nop.Core\bin\FruitBank\Debug\net9.0\Mango.Nop.Core.dll</HintPath>
</Reference>
</ItemGroup>
</ItemGroup>
</Project>
<ItemGroup>
<ProjectReference Include="..\..\..\..\Aycode\Source\AyCode.Core\AyCode.Core.Serializers.SourceGenerator\AyCode.Core.Serializers.SourceGenerator.csproj"
OutputItemType="Analyzer"
ReferenceOutputAssembly="false" />
</ItemGroup>
</Project>

View File

@ -7,6 +7,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using FruitBank.Common.Entities;
namespace FruitBank.Common.Interfaces
{

View File

@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<!--<PublishTrimmed>true</PublishTrimmed>-->
<RunAOTCompilation>false</RunAOTCompilation>
<RunAOTCompilation>true</RunAOTCompilation>
<WasmStripILAfterAOT>true</WasmStripILAfterAOT>
<OverrideHtmlAssetPlaceholders>true</OverrideHtmlAssetPlaceholders>
</PropertyGroup>

View File

@ -39,6 +39,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AyCode.Blazor.Components.Te
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AyCode.Core", "..\..\..\Aycode\Source\AyCode.Core\AyCode.Core\AyCode.Core.csproj", "{EC0E3D9A-40DE-52EB-9E66-CFFBB36B5326}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AyCode.Core.Serializers.SourceGenerator", "..\..\..\Aycode\Source\AyCode.Core\AyCode.Core.Serializers.SourceGenerator\AyCode.Core.Serializers.SourceGenerator.csproj", "{1C882DAC-5027-BD65-9F22-A5FFF813FA36}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@ -107,6 +109,10 @@ Global
{EC0E3D9A-40DE-52EB-9E66-CFFBB36B5326}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EC0E3D9A-40DE-52EB-9E66-CFFBB36B5326}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EC0E3D9A-40DE-52EB-9E66-CFFBB36B5326}.Release|Any CPU.Build.0 = Release|Any CPU
{1C882DAC-5027-BD65-9F22-A5FFF813FA36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1C882DAC-5027-BD65-9F22-A5FFF813FA36}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1C882DAC-5027-BD65-9F22-A5FFF813FA36}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1C882DAC-5027-BD65-9F22-A5FFF813FA36}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@ -16,7 +16,7 @@ namespace FruitBankHybrid.WinUI
/// </summary>
public App()
{
this.InitializeComponent();
//this.InitializeComponent();
}
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();