From 621e46ead66488febe0914eaf419a67833405555 Mon Sep 17 00:00:00 2001 From: Chris Simmons Date: Sun, 25 Jan 2026 12:51:46 -0800 Subject: [PATCH] These don't belong here --- .../IApplicationAdvisoryLockService.cs | 28 ------------------ NetChris.Core/Patterns/IUnitOfWork.cs | 29 ------------------- 2 files changed, 57 deletions(-) delete mode 100644 NetChris.Core/Patterns/IApplicationAdvisoryLockService.cs delete mode 100644 NetChris.Core/Patterns/IUnitOfWork.cs diff --git a/NetChris.Core/Patterns/IApplicationAdvisoryLockService.cs b/NetChris.Core/Patterns/IApplicationAdvisoryLockService.cs deleted file mode 100644 index 74f3f79..0000000 --- a/NetChris.Core/Patterns/IApplicationAdvisoryLockService.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; - -namespace NetChris.Core.Patterns; - -/// -/// Provides advisory lock services for a distributed application -/// -/// -/// This is inspired by Postgres advisory locks. See the links below for more information. -/// -/// -/// -public interface IApplicationAdvisoryLockService -{ - /// - /// Sets a transaction-level advisory lock for specified value - /// - /// - /// As the name implies, the lock is help for the duration of a transaction. There is no prescription where that - /// transaction lives or how it is managed. It is up to the application to ensure that the implementation uses some - /// mechanism (usually a database transaction), to ensure that the transaction is resolved (committed or rolled back) - /// in a timely manner. - /// - /// The advisory lock ID - /// The cancellation token used when first acquiring the lock - Task SetTransactionAdvisoryLockAsync(int lockId, CancellationToken cancellationToken); -} \ No newline at end of file diff --git a/NetChris.Core/Patterns/IUnitOfWork.cs b/NetChris.Core/Patterns/IUnitOfWork.cs deleted file mode 100644 index d666c0f..0000000 --- a/NetChris.Core/Patterns/IUnitOfWork.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; - -namespace NetChris.Core.Patterns; - -/// -/// Presents a unit of work interface to coordinate a unit-of-work pattern operation against a data store. -/// -/// -/// -/// There is no prescribed implementation of this of course. However the primary use of this will be to wrap the operations -/// of an Entity Framework DbContext. And even though the DbContext's SaveChanges/Async operations constitute a unit -/// of work in and of themselves, it's important to have a separate handle on the over-arching unit of work for: -/// -/// Having an abstraction to use for testing in concert with repository abstractions. -/// Handle the common exceptions that can occur when saving changes to the database, and then wrap them in well-known exceptions. -/// Allow the ability to save/commit the unit of work without needing to reference the DbContext -/// -/// -/// -public interface IUnitOfWork -{ - /// - /// Commit the unit of work - /// - /// The cancellation token - /// A task that represents the asynchronous save operation. The task result contains the number of state entries written to the database. - Task SaveChangesAsync(CancellationToken cancellationToken = default); -} \ No newline at end of file