ArturRios.Data
1.0.0
dotnet add package ArturRios.Data --version 1.0.0
NuGet\Install-Package ArturRios.Data -Version 1.0.0
<PackageReference Include="ArturRios.Data" Version="1.0.0" />
<PackageVersion Include="ArturRios.Data" Version="1.0.0" />
<PackageReference Include="ArturRios.Data" />
paket add ArturRios.Data --version 1.0.0
#r "nuget: ArturRios.Data, 1.0.0"
#:package ArturRios.Data@1.0.0
#addin nuget:?package=ArturRios.Data&version=1.0.0
#tool nuget:?package=ArturRios.Data&version=1.0.0
Dotnet Data
Utilities for data access layer on .net projects
Installation
Install via the NuGet CLI or the .NET CLI:
dotnet add package ArturRios.Data
Or search for ArturRios.Data in the NuGet Package Manager inside Visual Studio.
Overview
ArturRios.Data provides a set of building blocks for the data access layer of .NET projects:
| Type | Description |
|---|---|
Entity |
Abstract base class for all domain entities. Exposes an int Id property mapped as the first column. |
ICrudRepository<T> |
Interface for full create / read / update / delete operations on a single entity. |
IReadOnlyRepository<T> |
Interface for read-only access — GetAll() and GetById(). |
IRangeRepository<T> |
Interface for bulk update and bulk delete by id list. |
BaseDbContextOptions |
Plain options class that carries a ConnectionString for configuring a DbContext. |
All repository interfaces are constrained to T : Entity, enforcing a consistent identity contract across the data layer.
Usage
1. Define an entity
using ArturRios.Data;
public class Product : Entity
{
public string Name { get; set; } = string.Empty;
public decimal Price { get; set; }
}
2. Implement a repository
using ArturRios.Data;
using ArturRios.Data.Interfaces;
public class ProductRepository : ICrudRepository<Product>
{
private readonly AppDbContext _db;
public ProductRepository(AppDbContext db) => _db = db;
public int Create(Product entity) { _db.Products.Add(entity); _db.SaveChanges(); return entity.Id; }
public IQueryable<Product> GetAll() => _db.Products;
public Product? GetById(int id) => _db.Products.Find(id);
public Product Update(Product entity) { _db.Products.Update(entity); _db.SaveChanges(); return entity; }
public int Delete(Product entity) { _db.Products.Remove(entity); _db.SaveChanges(); return entity.Id; }
}
3. Configure the DbContext
using ArturRios.Data.Configuration;
var options = new BaseDbContextOptions
{
ConnectionString = "Server=localhost;Database=mydb;Trusted_Connection=True;"
};
4. Use read-only or range interfaces when full CRUD is not needed
// Expose only read access
public class ProductQueryService(IReadOnlyRepository<Product> repo)
{
public IQueryable<Product> GetCatalog() => repo.GetAll();
}
// Bulk operations
public class ProductBatchService(IRangeRepository<Product> repo)
{
public void ArchiveMany(List<int> ids) => repo.DeleteRange(ids);
}
Requirements
- .NET 10.0 or later
Versioning
Semantic Versioning (SemVer). Breaking changes result in a new major version. New methods or non-breaking behavior changes increment the minor version; fixes or tweaks increment the patch.
Build, test and publish
Use the official .NET CLI to build, test and publish the project and Git for source control. If you want, optional helper toolsets I built to facilitate these tasks are available:
Legal Details
This project is licensed under the MIT License. A copy of the license is available at LICENSE in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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. |
-
net10.0
- No dependencies.
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 |
|---|---|---|
| 1.0.0 | 118 | 6/20/2026 |