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
- 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
Table |
Initializes a new instance of the TableAttribute class. |
Properties
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; }