Guler.Editor.Premium.Audit.EfCore 0.2.0-alpha.0

This is a prerelease version of Guler.Editor.Premium.Audit.EfCore.
dotnet add package Guler.Editor.Premium.Audit.EfCore --version 0.2.0-alpha.0
                    
NuGet\Install-Package Guler.Editor.Premium.Audit.EfCore -Version 0.2.0-alpha.0
                    
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="Guler.Editor.Premium.Audit.EfCore" Version="0.2.0-alpha.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Guler.Editor.Premium.Audit.EfCore" Version="0.2.0-alpha.0" />
                    
Directory.Packages.props
<PackageReference Include="Guler.Editor.Premium.Audit.EfCore" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Guler.Editor.Premium.Audit.EfCore --version 0.2.0-alpha.0
                    
#r "nuget: Guler.Editor.Premium.Audit.EfCore, 0.2.0-alpha.0"
                    
#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.
#:package Guler.Editor.Premium.Audit.EfCore@0.2.0-alpha.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Guler.Editor.Premium.Audit.EfCore&version=0.2.0-alpha.0&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Guler.Editor.Premium.Audit.EfCore&version=0.2.0-alpha.0&prerelease
                    
Install as a Cake Tool

Stylus.Premium.Audit.EfCore

Production-grade persistent IStylusAuditStore implementation for Stylus.Premium.Audit — EF Core 8 backed.

Sprint 7 yan paketi (ADR-011 §Sonraki Adımlar Faz 5 candidate). Stylus.Premium.Audit'in InMemoryAuditStore default'unu pilot/production'da değiştirir.

Kurulum

public class MyDbContext : DbContext
{
    public MyDbContext(DbContextOptions<MyDbContext> options) : base(options) { }

    public DbSet<StylusAuditVersion> StylusAuditVersions => Set<StylusAuditVersion>();

    protected override void OnModelCreating(ModelBuilder mb)
    {
        // Stylus audit tablo şemasını otomatik konfigüre et
        mb.ApplyStylusAuditConfiguration();
    }
}

// Program.cs
builder.Services.AddDbContext<MyDbContext>(opts =>
    opts.UseSqlite("Data Source=app.db"));

builder.Services.AddStylusPremium(license: cfg["Stylus:LicenseKey"]);
builder.Services.AddStylusAudit(opts => opts.RetentionDays = 90);
builder.Services.AddStylusAuditEfCore<MyDbContext>();   // ← bu paket

AddStylusAuditEfCore<TContext>() çağrısı:

  • IStylusAuditStore registration'ını EfCoreAuditStore<TContext> ile override eder (ana paketin InMemoryAuditStore default'unu değiştirir)
  • TContext'in DbSet<StylusAuditVersion> propertysi'ne erişebilmesi için marker interface yok — Stylus EF Core internal Context resolution kullanır

Migration

dotnet ef migrations add AddStylusAudit
dotnet ef database update

Veya programmatic:

using var scope = app.Services.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<MyDbContext>();
db.Database.Migrate();

Schema

Tek tablo: StylusAuditVersions

  • Id (long, PK, identity)
  • ContentKey (string, indexed)
  • VersionNumber (int)
  • Html (text)
  • UserId (string)
  • Title (string, nullable)
  • Timestamp (DateTimeOffset, indexed)

Composite unique index: (ContentKey, VersionNumber) — concurrent save'lerde çakışma koruması.

Atomik VersionNumber

InMemoryAuditStore Interlocked.Increment ile atomik artırma yapıyor; EF Core'da bu mümkün değil (multi-instance concurrent insert race condition). Çözüm:

  • (ContentKey, VersionNumber) UNIQUE INDEX
  • INSERT öncesi MAX(VersionNumber) + 1 SELECT (transaction içinde)
  • DbUpdateException UNIQUE violation yakalandığında 1 retry

Production'da SERIALIZABLE isolation level + retry policy ek güvence.

Tests

tests/Stylus.Premium.Audit.EfCore.Tests/Microsoft.EntityFrameworkCore.Sqlite in-memory ile.

İlgili kaynaklar

Product Compatible and additional computed target framework versions.
.NET 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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows 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
0.2.0-alpha.0 81 5/1/2026