Files
Migu2.0/MiGu.DB/Abstractions/Exceptions/Exceptions.cs
T

43 lines
1.1 KiB
C#
Raw Normal View History

namespace MiGu.DB.Abstractions.Exceptions;
public sealed class ConcurrencyConflictException : Exception
{
public string EntityType { get; }
public object? EntityId { get; }
public long? ExpectedVersion { get; }
public ConcurrencyConflictException(string entityType, object? entityId, long? expectedVersion = null)
: base("数据已被其他用户修改,请刷新后重试")
{
EntityType = entityType;
EntityId = entityId;
ExpectedVersion = expectedVersion;
}
}
public sealed class EntityLockedException : Exception
{
public string EntityType { get; }
public object? EntityId { get; }
public EntityLockedException(string entityType, object? entityId)
: base("数据已锁定,不能修改")
{
EntityType = entityType;
EntityId = entityId;
}
}
public sealed class EntityNotFoundException : Exception
{
public string EntityType { get; }
public object? EntityId { get; }
public EntityNotFoundException(string entityType, object? entityId)
: base("数据不存在")
{
EntityType = entityType;
EntityId = entityId;
}
}