SplatDev.Database 1.0.2

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

SplatDev.Database

Generic NPoco-based CRUD repository layer with automatic table creation and attribute-driven migration support. Provides the IDbService<T> interface and DbService<T> abstract class for consistent database access across any NPoco-backed SQL database.

NuGet License: MIT

Compatibility

.NET Umbraco Package Version
8.0 13 1.0.0
10.0 17 1.0.0

Installation

dotnet add package SplatDev.Database

Configuration

DI registration

using SplatDev.Database;

// Register with NPoco DatabaseFactory
builder.Services.AddSingleton<IDatabaseFactory>(sp =>
    new DatabaseFactory("DefaultConnection"));
builder.Services.AddScoped<IDbService<MyEntity>, MyDbService>();

Define an entity

using SplatDev.Database.Attributes;
using NPoco;

[TableName("MyTable")]
[PrimaryKey("Id", AutoIncrement = true)]
public class MyEntity
{
    public int Id { get; set; }

    [NvarcharMax]
    public string Description { get; set; }

    [CreateOrder(1)]
    public string Name { get; set; }

    [AlteredColumn("PreviousName")]
    public string RenamedColumn { get; set; }

    public DateTime CreatedAt { get; set; }
}

Implement a service

using SplatDev.Database;

public class MyDbService : DbService<MyEntity>, IDbService<MyEntity>
{
    public MyDbService(IDatabaseFactory dbFactory)
        : base(dbFactory) { }

    public async Task<IEnumerable<MyEntity>> GetByNameAsync(string name)
    {
        return await FetchAsync("WHERE Name = @0", name);
    }
}

Usage

CRUD operations

var service = serviceProvider.GetRequiredService<IDbService<MyEntity>>();

// Create
var entity = new MyEntity { Name = "Example", CreatedAt = DateTime.UtcNow };
service.Insert(entity);

// Read
var item = service.GetById(1);

// Update
item.Name = "Updated";
service.Update(item);

// Delete
service.Delete(item);

// Query
var all = service.Fetch("WHERE CreatedAt > @0", DateTime.UtcNow.AddDays(-7));
var page = service.Page(1, 20, "ORDER BY CreatedAt DESC");

Automatic table creation

DbService<T> inspects the entity model at startup and automatically creates the database table if it does not exist — no manual SQL scripts required.

Migration support

  • [CreateOrder] — Controls column ordering in generated CREATE TABLE statements
  • [NvarcharMax] — Marks string properties for NVARCHAR(MAX) instead of NVARCHAR(255)
  • [AlteredColumn] — Tracks column renames for migration scripts, stores original name

Features

  • IDbService<T> interface for testable, injectable data access
  • DbService<T> abstract base class with full CRUD: Insert, Update, Delete, GetById, Fetch, Page
  • Automatic table creation from entity model
  • Attribute-driven schema control: [CreateOrder], [NvarcharMax], [AlteredColumn]
  • Built on NPoco for lightweight, high-performance micro-ORM access
  • Compatible with any NPoco-supported database (SQL Server, SQLite, PostgreSQL, MySQL)

Dependencies

Package Purpose
NPoco (v5.3.0) Lightweight micro-ORM
Microsoft.Extensions.DependencyInjection.Abstractions (v8.0.0) DI abstractions
SplatDev.Reflection.Helpers Reflection utilities for model inspection

Target Frameworks

  • net8.0 — for Umbraco 13 applications
  • net10.0 — for Umbraco 17 applications

SplatDev.Database — part of the SplatDev.Umbraco.Plugins suite. Licensed under MIT. © SplatDev Ltda.

Changelog

1.0.2 — 2026-08-24

Removes a dashboard screenshot that showed an error toast. It was captured against a site where this plugin's API was unreachable, so it advertised a broken dashboard. No screenshot is better than a misleading one; a replacement will be taken against a working install.

1.0.1 — 2026-08-24

Package metadata only: the listing now carries an icon and search tags, and the project and repository links point at the organisation that actually hosts this code. No code changes.

1.0.0 — 2026-08-24

This package now keeps a changelog. Earlier releases predate it and are not reconstructed here — consult the repository history for those. From this version on, every release records what changed for someone using it.

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 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.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on SplatDev.Database:

Package Downloads
SplatDev.Database.MSSQLAdmin

MSSQL database administration utilities extending SplatDev.Database

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.2 69 8/24/2026