RSCG – Ling.Audit
RSCG – Ling.Audit
name | Ling.Audit |
nuget | https://www.nuget.org/packages/Ling.Audit/ |
link | https://github.com/ling921/dotnet-lib/ |
author | Jing Ling |
Generating audit data from class implementation of interfaces
This is how you can use Ling.Audit .
The code that you start with is
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 | < 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 > |
The code that you will use is
01 02 03 04 05 06 07 08 09 10 | // 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); |
1 2 3 4 5 6 7 8 9 | 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; } |
The code that is generated is
01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | // <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 ; } } } |
Code and pdf at
https://ignatandrei.github.io/RSCG_Examples/v2/docs/Ling.Audit
Leave a Reply