SplatDev.Umbraco.NPoco 2.0.5

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

SplatDev.Umbraco.NPoco

NPoco database layer for Umbraco — provides BaseEntityRepository<T> with automatic IScopeProvider integration, ambient scope management, SuperUser identity fallback, event-driven auditing, and bulk CRUD operations. Built on top of Umbraco's native NPoco infrastructure.

NuGet License: MIT

Compatibility

.NET Umbraco Package Version
8.0 13.12.0 1.0.0
10.0 17.3.4 1.0.0

Installation

dotnet add package SplatDev.Umbraco.NPoco

Configuration

DI registration

using SplatDev.Umbraco.NPoco;

// Register your repository implementation
builder.Services.AddScoped<IMyEntityRepository, MyEntityRepository>();

Define an entity

using NPoco;

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

Implement a repository

using SplatDev.Umbraco.NPoco;
using Umbraco.Cms.Infrastructure.Scoping;

public class MyEntityRepository : BaseEntityRepository<MyEntity>, IMyEntityRepository
{
    public MyEntityRepository(IScopeProvider scopeProvider)
        : base(scopeProvider) { }

    public async Task<IEnumerable<MyEntity>> GetActiveAsync()
    {
        return await FetchAsync("WHERE IsActive = 1 ORDER BY CreatedAt DESC");
    }
}

Usage

CRUD operations

var repo = serviceProvider.GetRequiredService<IMyEntityRepository>();

// Scope management is automatic — no need to manually begin/commit
// Each method wraps its database work in an ambient IScope

// Insert
var entity = new MyEntity { Name = "Example" };
repo.Insert(entity);

// Get by ID
var item = repo.GetById(1);

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

// Delete
repo.Delete(item);

// Fetch with SQL
var recent = repo.Fetch("WHERE CreatedAt > @0", DateTime.UtcNow.AddDays(-7));

Bulk operations

// Insert multiple records in one batch
var entities = Enumerable.Range(1, 100).Select(i => new MyEntity
{
    Name = $"Bulk Item {i}"
}).ToList();

repo.InsertBulk(entities);

// Update multiple records
repo.UpdateBulk(entities);

// Delete multiple records by ID
repo.DeleteBulk(new[] { 1, 2, 3, 4, 5 });

Auto-complete scopes

BaseEntityRepository<T> automatically wraps every database operation in an ambient IScope:

// No manual scope.Begin() or scope.Complete() needed
// The repository handles scope lifecycle internally

var item = repo.GetById(42);          // Auto-scoped
repo.Insert(new MyEntity());           // Auto-scoped with auto-commit
repo.Update(existingItem);             // Auto-scoped with auto-commit

SuperUser fallback

When no authenticated backoffice user is available (e.g., during scheduled tasks or background jobs), the repository automatically falls back to the SuperUser identity (-1) for audit fields like CreatedBy and UpdatedBy.

Auditing via ActionCompletedEvent

// Audit changes by subscribing to the event
MyEntityRepository.ActionCompleted += (sender, entity) =>
{
    Console.WriteLine($"Action completed on entity {entity.Id}");
    // Log, notify, or trigger downstream workflows
};

Features

  • BaseEntityRepository<T> — Generic base class with full CRUD
  • Automatic IScopeProvider integration — scopes managed internally
  • Ambient scope auto-completion — no manual Begin()/Complete() required
  • SuperUser identity fallback for non-interactive contexts
  • Event-driven auditing via ActionCompletedEvent
  • Bulk insert, update, and delete operations
  • Uses Umbraco's native IScopeProvider and NPoco infrastructure

Dependencies

Package Purpose
Umbraco.Cms.Core (v13.12.0 / v17.3.4) Umbraco core APIs
Umbraco.Cms.Infrastructure (v13.12.0 / v17.3.4) IScopeProvider, NPoco integration

NPoco is included implicitly via Umbraco.Cms.Infrastructure — no additional NPoco package reference required.

Target Frameworks

  • net8.0 — for Umbraco 13 applications (v13.12.0)
  • net10.0 — for Umbraco 17 applications (v17.3.4)

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

Changelog

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

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

2.0.2 — 2026-08-22

  • This package's README now reaches NuGet. The publish workflow discovered packages by a list of name patterns, and this one matched none of them, so it was never built or pushed by CI — the version on NuGet was placed there by hand before the README was wired up, and no release could refresh it. Discovery is now by prefix, so the package ships whenever the repo is tagged.
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

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.5 85 8/24/2026