TableAttribute Class

An attribute that qualifies any class representing a row of a table, associating the class with the table that has the specified name.

C#
[AttributeUsage(System.AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
public sealed class TableAttribute : Attribute
Inheritance
TableAttribute
Attributes

Examples

using Maroontress.SqlBind;

[Table("properties")]
public record class PropertyRow(
    [Column("key")][Unique] string Key,
    [Column("value")] string Value)
{
}

Remarks

The class that this attribute qualifies must have a single constructor, every parameter of which must be qualified with ColumnAttribute. And the class must have the properties corresponding to those parameters. Each property must have the same name as the corresponding parameter, in the simular way of a record class.

See: SQLite CREATE TABLE.

Constructors

TableAttribute(string)

Initializes a new instance of the TableAttribute class.

Properties

Name

Gets the table name.

TypeId (Inherited from Attribute)

Methods

Equals(object) (Inherited from Attribute)
GetHashCode() (Inherited from Attribute)
IsDefaultAttribute() (Inherited from Attribute)
Match(object) (Inherited from Attribute)
GetType() (Inherited from object)
MemberwiseClone() (Inherited from object)
ToString() (Inherited from object)

See Also

Constructors Detail

TableAttribute(string)

Initializes a new instance of the TableAttribute class.

C#
public TableAttribute(string name)

Parameters

name
string

The table name.

Properties Detail

Name

Gets the table name.

C#
public string Name { get; }

Property Value