Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

41 lines
1.3 KiB

// ==========================================================================
// DomainObjectVersionException.cs
// Squidex Headless CMS
// ==========================================================================
// Copyright (c) Squidex Group
// All rights reserved.
// ==========================================================================
using System;
namespace Squidex.Infrastructure
{
public class DomainObjectVersionException : DomainObjectException
{
private readonly long currentVersion;
private readonly long expectedVersion;
public long CurrentVersion
{
get { return currentVersion; }
}
public long ExpectedVersion
{
get { return expectedVersion; }
}
public DomainObjectVersionException(string id, Type type, long currentVersion, long expectedVersion)
: base(FormatMessage(id, type, currentVersion, expectedVersion), id, type)
{
this.currentVersion = currentVersion;
this.expectedVersion = expectedVersion;
}
private static string FormatMessage(string id, Type type, long currentVersion, long expectedVersion)
{
return $"Requested version {expectedVersion} for object '{id}' (type {type}), but found {currentVersion}.";
}
}
}