Path: redb/redb.Core/Exceptions/RedbSchemeNameException.cs
Snapshot: redb, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb
Page: https://redbase.app/src/dev-2026-12-06/redb/redb.Core/Exceptions/RedbSchemeNameException.cs
----
namespace redb.Core.Exceptions;
///
/// Thrown when a type declares an explicit scheme name ([RedbScheme(Name = "...")]) that
/// breaks the scheme naming rules. Raised before any SQL is issued, so the developer gets the
/// offending type and the broken rule instead of a raw constraint violation from the driver.
///
public class RedbSchemeNameException : Exception
{
/// The class that declared the invalid name.
public Type DeclaringType { get; }
/// The rejected name, as written in the attribute.
public string? SchemeName { get; }
public RedbSchemeNameException(Type declaringType, string? schemeName, string reason)
: base($"Type '{declaringType.FullName ?? declaringType.Name}' declares " +
$"[RedbScheme(Name = \"{schemeName}\")], which is not a valid scheme name: {reason}. " +
"Scheme names follow C# identifier rules (Latin letters, digits, '_', '.' and '+'); " +
"use Alias for human-readable titles.")
{
DeclaringType = declaringType;
SchemeName = schemeName;
}
}