IVirtualizationUnitOfWork

Unit of work over one virtualisation environment. The environment (a Hyper-V management scope, a Proxmox node) is the data store; a virtual machine is a record.

Note

Shaped like every other unit of work in netbase: I{Domain}UnitOfWork : IUnitOfWork plus TYPED repository properties, and NOTHING else. Committing is declared by ICanCommit and ICanCommitAsync - a domain unit of work does not redeclare it, with or without a payload. No generic accessor either: with one entity it would return the same object as VirtualMachines while turning a wrong type argument from a compile error into a runtime throw. A domain that later need one derive netbase IRepositoryProvider2, which is constrained and hand out the full repository.

What a commit DID is therefore not returned. A commit that fail throw VirtualMachineCommitException, which carry the whole outcome - a partially failed commit is the case where a caller need it. A caller that want to know what a SUCCESSFUL commit changed read the store back; that is what every other repository in the solution do.

ICanCommitAsync.CommitAsync is the REAL path; the synchronous ICanCommit.Commit inherited from IUnitOfWork delegate to it, because every hypervisor operation underneath is asynchronous.

public interface IVirtualizationUnitOfWork : IUnitOfWork, ICanCommitAsync

1. Properties

1.1. VirtualMachines

Gets the virtual machines in this environment. Insert, Update and Delete are buffered until commit; reads are always live and never see pending changes.

IVirtualMachineRepository VirtualMachines { get; }