laget.Auditing
2.0.93
Prefix Reserved
.NET 6.0
This package targets .NET 6.0. The package is compatible with this framework or higher.
.NET Standard 2.0
This package targets .NET Standard 2.0. The package is compatible with this framework or higher.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package laget.Auditing --version 2.0.93
NuGet\Install-Package laget.Auditing -Version 2.0.93
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.93" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add laget.Auditing --version 2.0.93
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: laget.Auditing, 2.0.93"
#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.93 // Install laget.Auditing as a Cake Tool #tool nuget:?package=laget.Auditing&version=2.0.93
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
laget.Auditing
A simple framework to audit entities in .NET and .NET Core...
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 | Versions 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.
-
.NETStandard 2.0
- laget.Azure.ServiceBus (>= 2.2.48)
-
.NETStandard 2.1
- laget.Azure.ServiceBus (>= 2.2.48)
-
net6.0
- laget.Azure.ServiceBus (>= 2.2.48)
-
net8.0
- laget.Azure.ServiceBus (>= 2.2.48)
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.99 | 72 | 10/22/2024 | |
2.0.98 | 102 | 9/3/2024 | |
2.0.97 | 114 | 6/3/2024 | |
2.0.96 | 130 | 5/6/2024 | |
2.0.95 | 240 | 3/4/2024 | |
2.0.94 | 246 | 1/20/2024 | |
2.0.93 | 202 | 12/6/2023 | |
2.0.92 | 186 | 10/25/2023 | |
2.0.91 | 165 | 10/12/2023 | |
1.3.89 | 225 | 10/3/2023 | |
1.3.88 | 166 | 9/4/2023 | |
1.3.87 | 192 | 7/3/2023 | |
1.3.84 | 177 | 5/15/2023 | |
1.3.82 | 260 | 4/3/2023 | |
1.3.81 | 274 | 3/10/2023 | |
1.2.79 | 283 | 3/6/2023 | |
1.2.72 | 365 | 12/5/2022 | |
1.2.71 | 421 | 11/7/2022 | |
1.2.69 | 427 | 10/5/2022 | |
1.2.67 | 517 | 9/5/2022 | |
1.2.65 | 475 | 9/5/2022 | |
1.2.62 | 532 | 7/18/2022 | |
1.2.55 | 552 | 6/15/2022 | |
1.2.54 | 552 | 6/7/2022 | |
1.2.53 | 582 | 6/7/2022 | |
1.2.52 | 579 | 5/18/2022 | |
1.2.51 | 592 | 5/2/2022 | |
1.2.50 | 605 | 4/5/2022 | |
1.2.49 | 641 | 3/7/2022 | |
1.2.48 | 582 | 2/17/2022 | |
1.2.47 | 618 | 2/7/2022 | |
1.2.46 | 615 | 2/2/2022 | |
1.2.45 | 349 | 1/3/2022 | |
1.2.44 | 365 | 12/22/2021 | |
1.2.43 | 349 | 12/6/2021 | |
1.2.42 | 333 | 11/28/2021 | |
1.2.38 | 520 | 11/6/2021 | |
1.2.37 | 412 | 11/5/2021 | |
1.2.36 | 402 | 11/3/2021 | |
1.2.35 | 411 | 11/3/2021 | |
1.2.34 | 430 | 11/3/2021 | |
1.2.30 | 478 | 10/29/2021 | |
1.2.28 | 418 | 10/29/2021 | |
1.2.26 | 392 | 10/29/2021 | |
1.2.25 | 414 | 10/29/2021 | |
1.2.24 | 395 | 10/26/2021 | |
1.2.23 | 410 | 10/26/2021 | |
1.2.22 | 412 | 10/26/2021 | |
1.2.21 | 435 | 10/12/2021 | |
1.2.18 | 495 | 10/7/2021 |