Atis.Reference 2.0.0-preview.4

This is a prerelease version of Atis.Reference.
dotnet add package Atis.Reference --version 2.0.0-preview.4
                    
NuGet\Install-Package Atis.Reference -Version 2.0.0-preview.4
                    
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="Atis.Reference" Version="2.0.0-preview.4" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Atis.Reference" Version="2.0.0-preview.4" />
                    
Directory.Packages.props
<PackageReference Include="Atis.Reference" />
                    
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 Atis.Reference --version 2.0.0-preview.4
                    
#r "nuget: Atis.Reference, 2.0.0-preview.4"
                    
#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 Atis.Reference@2.0.0-preview.4
                    
#: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=Atis.Reference&version=2.0.0-preview.4&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Atis.Reference&version=2.0.0-preview.4&prerelease
                    
Install as a Cake Tool

Atis.Reference

Ortaq ATIS DB-nin lüğət (lookup) cədvəlləri üçün read-only EF Core mapping-ləri və keşlənən oxuyucu. Servislər dbo.EducationLevel, dbo.DocumentType və s. cədvəlləri öz entity-ləri kimi kopyalamır — bu paketi qoşub oxuyur. 27 cədvəl (ReferenceTables sabitləri), hamısı dbo, hamısı yalnız oxu.

Qeydiyyat

// DI
services.AddAtisPersistence<StaffDbContext>(configuration, o => o.Schema = "staff");
services.AddAtisReference<StaffDbContext>();          // AddMemoryCache() + IReferenceService

// Context
public sealed class StaffDbContext(DbContextOptions<StaffDbContext> o, AtisDbContextOptions<StaffDbContext> a)
    : AtisDbContextBase(o, a)
{
    protected override void ConfigureModel(ModelBuilder b)
    {
        b.ApplyAtisReference();                       // 27 lüğət: dbo, ToAtisReadOnlyTable, ExcludeFromMigrations
        b.ApplyConfigurationsFromAssembly(typeof(StaffDbContext).Assembly);
    }
}

AddAtisReference<TContext> IUnitOfWork<TContext>-ə söykənir — deməli AddAtisPersistence<TContext> əvvəl çağırılmalıdır. IReferenceService scoped-dır, keş (IMemoryCache) isə proses-səviyyəlidir.

İstifadə

public sealed class StaffService(IReferenceService references)
{
    public async Task<IReadOnlyList<EducationLevel>> LevelsAsync(CancellationToken ct)
        => await references.GetAllAsync<EducationLevel>(ct);       // 10 dəq keş

    public Task<DocumentType?> DocumentTypeAsync(int id, CancellationToken ct)
        => references.GetAsync<DocumentType>(id, ct);              // eyni keşdən tapır
}
  • GetAllAsync<T>() — bütün sətirlər, Id üzrə; ilk çağırışda DB, sonra 10 dəqiqə keş.
  • GetAsync<T>(id) — GetAllAsync keşindən; ayrıca DB sorğusu yoxdur.
  • Invalidate<T>() — keşi sil (lüğət ATIS Core tərəfindən dəyişdirildikdən sonra, məs. admin əməliyyatı və ya event ilə). Keş prosesə bağlıdır — çox instansiyalı deploy-da hər instansiya öz keşini saxlayır; 10 dəqiqəlik TTL bunun üçün qəbul edilən gecikmədir.

Entity formaları (Atis.Reference.Entities)

Baza Sahələr Nümunə cədvəllər
NamedReference Id, Name EducationLevel, EducationStage, Gender, Positions, …
BilingualReference Id, NameAz, NameEn Countries, Citizenship, …
ValueReference Id, Value DimSpecialtyGroup, …
QuestionnaireReference BilingualReference + SubCoefficient, Group Anket lüğətləri

Hamısı IReferenceEntity : IOriginEntity<int>. Sütun adları xassə adları ilə eynidir (ATIS Core-da [Column] arqumentsizdir); DisplayName kimi hesablanan xassələr Ignore olunur. Cədvəl adları ATIS DB-dəki faktiki adlardır və hamısı cəm/tək baxımından tutarlı deyil (EducationLevel amma EducationTypes) — ReferenceTables sabitlərini işlət, sətir yazma.

Qoruma

Mapping ToAtisReadOnlyTable ilə gedir: ExcludeFromMigrations (servisin migration-ı dbo-ya toxunmur)

  • Atis:Owned=false annotasiyası. Atis.Persistence-in ReadOnlyEntitySaveChangesInterceptor-u bu entity-lərdə Added/Modified/Deleted görəndə AtisReadOnlyEntityException atır — lüğəti servisdən dəyişmək mümkün deyil, sahibi ATIS Core-dur (spec §2.1).

Yeni lüğət əlavə etmək

  1. Entities/-də uyğun bazadan (NamedReference və s.) entity; 2. ReferenceTables-a cədvəl adı sabiti;
  2. Configurations/-də ReferenceConfiguration<TEntity> ilə mapping; 4. ApplyAtisReference-ə qoş;
  3. tests/Atis.Reference.Tests-də SQLite ilə oxu testi. dbo-ya yeni cədvəl bu paketdən yaradılmır — ATIS Core-un SQL script prosesi ilə.
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
2.0.0-preview.4 64 9/14/2026

2.0.0-preview.1: 27 dbo lüğət cədvəli üçün read-only mapping (ApplyAtisReference) və 10 dəqiqəlik keşli IReferenceService (AddAtisReference).