ArturRios.Data 1.0.0

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

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:

This project is licensed under the MIT License. A copy of the license is available at LICENSE in the repository.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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