PgCastAttribute
Namespace: Ankus
Assembly: Ankus.Runtime.dll
Exposes a static method or C# conversion declaration as a PostgreSQL function and a cast from its first parameter to its return type. Add PgFunction to customize the backing function’s name, schema, or execution options.
[AttributeUsage(AttributeTargets.Method)]public sealed class PgCastAttribute : AttributeDeclares a cast with the selected conversion context. C# implicit or explicit syntax does not select the PostgreSQL conversion context. Conversions retain their exact parameter and result types, including checked implementations.
Inheritance: object, Attribute
Constructors
Section titled “Constructors”PgCastAttribute(PgCastContext)
Section titled “PgCastAttribute(PgCastContext)”Exposes a static method or C# conversion declaration as a PostgreSQL function and a cast from its first parameter to its return type. Add PgFunction to customize the backing function’s name, schema, or execution options.
public PgCastAttribute(PgCastContext context = PgCastContext.Explicit)Parameters:
context — PgCastContext
The permitted conversion context; explicit by default.
Declares a cast with the selected conversion context. C# implicit or explicit syntax does not select the PostgreSQL conversion context. Conversions retain their exact parameter and result types, including checked implementations.
Properties
Section titled “Properties”Context
Section titled “Context”Gets where PostgreSQL may apply this cast.
public PgCastContext Context { get; }Value: PgCastContext
Gets or sets the dependency identifier for the cast, independently of its backing function.
public string? Id { get; set; }Value: string
Requires
Section titled “Requires”Gets or sets declarations that must precede CREATE CAST.
public string[] Requires { get; set; }Value: string[]