Ling.Audit by Jing Ling
NuGet / site data
Details
Info
Name: Ling.Audit
A source generator for audit properties.
Author: Jing Ling
NuGet: https://www.nuget.org/packages/Ling.Audit/
You can find more details at https://github.com/ling921/dotnet-lib/
Original Readme
Introduction
This is a dotnet library repository that contains the following public libraries
| Project | Package | Description |
|---|---|---|
Ling.Cache | A cache library that can easily use memory cache or redis cache. | |
Ling.Audit | A source generator to generate audit properties. | |
Ling.EntityFrameworkCore | An extension library of Microsoft.EntityFrameworkCore. | |
Ling.EntityFrameworkCore.Audit | An extension library that can automatically record entity changes of Microsoft.EntityFrameworkCore. | |
Ling.Blazor | A library for Blazor. | |
Ling.Blazor.Authentication | A library that provides JWT authentication for Blazor applications. |
License
This project is licensed under the Apache-2.0
About
Generating audit data from class implementation of interfaces
How to use
Example (source csproj, source files)
- CSharp Project
- Program.cs
- Person.cs
This is the CSharp Project that references Ling.Audit
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Ling.Audit" Version="1.1.0" />
</ItemGroup>
<PropertyGroup>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GX</CompilerGeneratedFilesOutputPath>
</PropertyGroup>
</Project>
This is the use of Ling.Audit in Program.cs
// See https://aka.ms/new-console-template for more information
using LingDemo;
Console.WriteLine("Hello, World!");
var p = new Person();
await Task.Delay(2000);
p.FirstName = "Andrei";
p.LastName = "Ignat";
Console.WriteLine(p.CreationTime);
Console.WriteLine(p.LastModificationTime);
This is the use of Ling.Audit in Person.cs
using Ling.Audit;
namespace LingDemo;
partial class Person :IFullAudited<Guid>
{
public int ID { get; set; }
public string FirstName { get; set; }= string.Empty;
public string LastName { get; set; } = string.Empty;
}
Generated Files
Those are taken from $(BaseIntermediateOutputPath)\GX
- Person.g.cs
// <auto-generated/>
#nullable enable annotations
#nullable disable warnings
namespace LingDemo
{
partial class Person
{
/// <summary>
/// Gets or sets the creation time of this entity.
/// </summary>
public virtual global::System.DateTimeOffset CreationTime { get; set; }
/// <summary>
/// Gets or sets the creator Id of this entity.
/// </summary>
public virtual global::System.Nullable<global::System.Guid> CreatorId { get; set; }
/// <summary>
/// Gets or sets the last modification time of this entity.
/// </summary>
public virtual global::System.Nullable<global::System.DateTimeOffset> LastModificationTime { get; set; }
/// <summary>
/// Gets or sets the last modifier Id of this entity.
/// </summary>
public virtual global::System.Nullable<global::System.Guid> LastModifierId { get; set; }
/// <summary>
/// Gets or sets whether this entity is soft deleted.
/// </summary>
public virtual global::System.Boolean IsDeleted { get; set; }
/// <summary>
/// Gets or sets the deletion time of this entity.
/// </summary>
public virtual global::System.Nullable<global::System.DateTimeOffset> DeletionTime { get; set; }
/// <summary>
/// Get or set the deleter Id of this entity.
/// </summary>
public virtual global::System.Nullable<global::System.Guid> DeleterId { get; set; }
}
}
Useful
Download Example (.NET C#)
Share Ling.Audit
https://ignatandrei.github.io/RSCG_Examples/v2/docs/Ling.Audit
aaa
Category "EnhancementClass" has the following generators:
1 ApparatusAOT
2023-04-16
2 AspectGenerator
2024-01-07
3 CommonCodeGenerator
2024-04-03
4 Comparison
2025-05-25
5 DudNet
2023-10-27
6 Enhanced.GetTypes
2024-09-17
7 FastGenericNew
2023-08-10
8 Immutype
2023-08-12
9 Ling.Audit
2023-12-12
10 Lombok.NET
2023-04-16
11 M31.FluentAPI
2023-08-25
12 MemberAccessor
2025-03-24
13 MemoryPack
2023-08-04
14 Meziantou.Polyfill
2023-10-10
15 Microsoft.Extensions.Logging
2023-04-16
16 Microsoft.Extensions.Options.Generators.OptionsValidatorGenerator
2023-11-17
17 Microsoft.Interop.JavaScript.JSImportGenerator 2023-04-16
18 OptionToStringGenerator
2024-02-15
19 Program
2025-11-06
20 QueryStringGenerator
2024-11-07
21 RSCG_Decorator
2023-09-30
22 RSCG_UtilityTypes
2023-12-22
23 StaticReflection
2023-10-13
24 SyncMethodGenerator
2023-08-14
25 System.Runtime.InteropServices
2023-04-16
26 System.Text.RegularExpressions
2023-04-16
27 TelemetryLogging
2023-11-30
28 ThisClass
2024-04-19