Reo.Core.Infrastructure.Abstractions 8.0.331

There is a newer version of this package available.
See the version list below for details.
dotnet add package Reo.Core.Infrastructure.Abstractions --version 8.0.331
                    
NuGet\Install-Package Reo.Core.Infrastructure.Abstractions -Version 8.0.331
                    
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="Reo.Core.Infrastructure.Abstractions" Version="8.0.331" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Reo.Core.Infrastructure.Abstractions" Version="8.0.331" />
                    
Directory.Packages.props
<PackageReference Include="Reo.Core.Infrastructure.Abstractions" />
                    
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 Reo.Core.Infrastructure.Abstractions --version 8.0.331
                    
#r "nuget: Reo.Core.Infrastructure.Abstractions, 8.0.331"
                    
#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 Reo.Core.Infrastructure.Abstractions@8.0.331
                    
#: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=Reo.Core.Infrastructure.Abstractions&version=8.0.331
                    
Install as a Cake Addin
#tool nuget:?package=Reo.Core.Infrastructure.Abstractions&version=8.0.331
                    
Install as a Cake Tool

Reo.Core.Infrastructure.Abstractions

Описание пакета

Пакет Reo.Core.Infrastructure.Abstractions предоставляет абстрактные интерфейсы и базовые реализации для работы с репозиториями и сущностями в приложениях на C#. Он решает задачу унификации и абстракции доступа к данным, позволяя разделять логику приложения и реализацию хранилищ. Это упрощает тестирование, модульность и поддержку кода.

Функции:

  • Обобщённые интерфейсы для чтения и записи данных (IReoReadOnlyRepository, IReoWriteOnlyRepository).
  • Поддержка сущностей с идентификаторами Id (для справочников) и Uuid (для универсальных сущностей).
  • Асинхронные методы для взаимодействия с репозиториями.

Основные компоненты

1. IEntityReference

  • Интерфейс для сущностей-справочников с целочисленным идентификатором Id.

2. IEntityUuid

  • Интерфейс для сущностей с универсальным уникальным идентификатором Uuid.

3. IReoReferenceReadOnlyRepository<TEntity>

  • Репозиторий для чтения сущностей-справочников.
  • Методы: GetAsync(int id, CancellationToken token), GetAsync(Expression<Func<TEntity, bool>> filter, CancellationToken token).

4. IReoReadOnlyRepository<TEntity>

  • Репозиторий для чтения сущностей с Uuid.
  • Методы: GetAsync(Guid id, CancellationToken token), GetAsync(Expression<Func<TEntity, bool>> filter, CancellationToken token).

5. IReoWriteOnlyRepository<TEntity>

  • Репозиторий для записи данных.
  • Методы: SaveAsync(TEntity entity, CancellationToken token), SaveAsync(IReadOnlyCollection<TEntity> entities, CancellationToken token).

6. ReoReadOnlyRepositoryBase<TEntity>

  • Базовый класс для реализации IReoReadOnlyRepository<TEntity>.

7. ReoWriteOnlyRepositoryBase<TEntity>

  • Базовый класс для реализации IReoWriteOnlyRepository<TEntity>.

Требования

  • .NET: Совместим с версиями .NET 8.0 и .NET 9.0.
  • Зависимости:
    • System.Linq.Expressions (для фильтрации сущностей).
    • JetBrains.Annotations (для атрибутов аннотаций, например, [UsedImplicitly]).

Установка

Установите пакет через NuGet Package Manager или .NET CLI:

Install-Package Reo.Core.Infrastructure.Abstractions

или

dotnet add package Reo.Core.Infrastructure.Abstractions

Настройка

Для использования в ASP.NET Core:

  1. Регистрируйте репозитории в DI-контейнере (например, через AddScoped или AddTransient).
  2. Если требуется, добавьте реализации репозиториев (например, на основе EF Core или другого ORM).

Пример регистрации в DI:

services.AddScoped<IReoReferenceReadOnlyRepository<MyEntity>, MyEntityRepository>();
services.AddScoped<IReoWriteOnlyRepository<MyEntity>, MyEntityRepository>();

Конфигурационные параметры: N/A (пакет не требует внешней настройки).

Использование

Пример 1: Чтение сущности по Id

var repository = serviceProvider.GetRequiredService<IReoReferenceReadOnlyRepository<MyEntity>>();
var entity = await repository.GetAsync(123, CancellationToken.None);

Пример 2: Сохранение сущности

var repository = serviceProvider.GetRequiredService<IReoWriteOnlyRepository<MyEntity>>();
var newEntity = new MyEntity { Uuid = Guid.NewGuid(), Name = "Test" };
var savedId = await repository.SaveAsync(newEntity, CancellationToken.None);

Пример 3: Батч-сохранение

var entities = new List<MyEntity>
{
    new MyEntity { Uuid = Guid.NewGuid(), Name = "Item 1" },
    new MyEntity { Uuid = Guid.NewGuid(), Name = "Item 2" }
};

var count = await repository.SaveAsync(entities, CancellationToken.None);
Console.WriteLine($"Сохранено {count} записей.");

Лицензия

Этот пакет распространяется под лицензией MIT. См. файл LICENSE для подробностей.

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
10.0.138 25 5/7/2026
10.0.135 21 5/7/2026
10.0.134 27 5/7/2026
10.0.133 27 5/7/2026
10.0.132 25 5/7/2026
10.0.131 30 5/7/2026
10.0.130 30 5/6/2026
10.0.129 30 5/6/2026
10.0.128 46 5/6/2026
10.0.127 65 5/5/2026
10.0.126 74 5/5/2026
10.0.125 99 4/27/2026
10.0.124 89 4/24/2026
10.0.120 89 4/24/2026
10.0.119 88 4/23/2026
10.0.117 90 4/23/2026
10.0.116 92 4/22/2026
10.0.115 89 4/22/2026
10.0.114 88 4/21/2026
8.0.331 241 5/22/2025
Loading failed