laget.Auditing 2.0.95

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
There is a newer version of this package available.
See the version list below for details.
dotnet add package laget.Auditing --version 2.0.95
NuGet\Install-Package laget.Auditing -Version 2.0.95
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="laget.Auditing" Version="2.0.95" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add laget.Auditing --version 2.0.95
#r "nuget: laget.Auditing, 2.0.95"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install laget.Auditing as a Cake Addin
#addin nuget:?package=laget.Auditing&version=2.0.95

// Install laget.Auditing as a Cake Tool
#tool nuget:?package=laget.Auditing&version=2.0.95

laget.Auditing

A simple framework to audit entities in .NET and .NET Core...

Nuget Nuget

Usage

By

public class By
{
    [JsonProperty("id")]
    public int Id { get; set; }
    [JsonProperty("name")]
    public string Name { get; set; }
    [JsonProperty("ip")]
    public string Ip { get; set; }
    [JsonProperty("referenceId")]
    public string ReferenceId { get; set; }
    [JsonProperty("superadmin")]
    public bool Superadmin { get; set; } = false;
}

Auditor

Events (built-in)
Activated Added Archived Archived Associated Attached
Cleaned Cloned Connected Created Deactivated Deleted
Descheduled Detached Disassociated Disconnected Enqueued Failed
Followed Information Inserted Migrated Published Purged
Removed Reported Restored Scheduled Sent Succeded
Unfollowed Unpublished Updated
.With(Expression<Func<IEvent, object>> expression, object value)
Property Type Default Description
ClubId int 0 Should be set if the event was triggered from the context of a club
SiteId int 0 Should be set if the event was triggered from the context of a site
System string Calling assembly Indicates what system the event was triggered from, is
Reference object null Indicates what object the event refers to, e.g. if you add an attribute for a user the attribute object should be set as the reference
By By (class) null Indicates what user, if any, triggered the event
Examples
public class AccountService
{
    private readonly IAuditor _auditor;
    private readonly IAccountRepository _repository;

    public AccountService(IAccountRepository repository)
    {
        _auditor = new Auditor("ServiceBusConnectionString");
        _repository = repository;
    }


    public Create(Account account, By by)
    {
        account = _repository.Create(account, By by);

        var message = new Created(nameof(Account), account)
            .With(x => x.By, by);

        _auditor.Send(message);
    }

    public Update(Account account, By by)
    {
        _repository.Update(account);

        var message = new Updated((nameof(Account), account)
            .With(x => x.By, by);

        _auditor.Send(message);
    }

    public Delete(Account account, By by)
    {
        _repository.Delete(account);

        var message = new Deleted((nameof(Account), account)
            .With(x => x.By, by);

        _auditor.Send(message);
    }

    public Remove(Account account, Site site, By by)
    {
        _repository.Delete(account);

        var message = new Remove((nameof(Account), account)
            .With(x => x.By, by)
            .With(x => x.Reference, site);

        _auditor.Send(message);
    }
}
public class AccountService
{
    private readonly IAuditor _auditor;
    private readonly IAccountRepository _repository;

    public AccountService(IAccountRepository repository)
    {
        _auditor = new Auditor("ServiceBusConnectionString");
        _repository = repository;
    }


    public Create(Account account, By by)
    {
        var account = new
        {
            id = 123,
            name = "Jane Doe"
        };
        var site = new
        {
            id = 123,
            name = "FC GonAce"
        };

        var message = new Created("Account", account)
            .With(x => x.By, by)
            .With(x => x.Reference, site);

        await _auditor.Send(message);
    }
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.96 83 5/6/2024
2.0.95 211 3/4/2024
2.0.94 211 1/20/2024
2.0.93 178 12/6/2023
2.0.92 157 10/25/2023
2.0.91 139 10/12/2023
1.3.89 185 10/3/2023
1.3.88 138 9/4/2023
1.3.87 162 7/3/2023
1.3.84 152 5/15/2023
1.3.82 229 4/3/2023
1.3.81 243 3/10/2023
1.2.79 254 3/6/2023
1.2.72 340 12/5/2022
1.2.71 394 11/7/2022
1.2.69 394 10/5/2022
1.2.67 486 9/5/2022
1.2.65 449 9/5/2022
1.2.62 504 7/18/2022
1.2.55 520 6/15/2022
1.2.54 519 6/7/2022
1.2.53 545 6/7/2022
1.2.52 551 5/18/2022
1.2.51 564 5/2/2022
1.2.50 570 4/5/2022
1.2.49 601 3/7/2022
1.2.48 556 2/17/2022
1.2.47 588 2/7/2022
1.2.46 579 2/2/2022
1.2.45 324 1/3/2022
1.2.44 337 12/22/2021
1.2.43 325 12/6/2021
1.2.42 303 11/28/2021
1.2.38 494 11/6/2021
1.2.37 387 11/5/2021
1.2.36 372 11/3/2021
1.2.35 383 11/3/2021
1.2.34 399 11/3/2021
1.2.30 450 10/29/2021
1.2.28 393 10/29/2021
1.2.26 364 10/29/2021
1.2.25 377 10/29/2021
1.2.24 366 10/26/2021
1.2.23 384 10/26/2021
1.2.22 383 10/26/2021
1.2.21 399 10/12/2021
1.2.18 466 10/7/2021