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
<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
// 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);
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
// <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