Table of Contents

Class TableAttribute

Namespace
LinqToDB.Mapping
Assembly
linq2db.dll

Maps databse table or view to a class or interface. You can apply it to any class including non-public, nester or abstract classes. Applying it to interfaces will allow you to perform queries against target table, but you need to specify projection in your query explicitly, if you want to select data from such mapping.

[AttributeUsage(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = true)]
public class TableAttribute : MappingAttribute, _Attribute
Inheritance
TableAttribute
Implements
Inherited Members
Extension Methods

Constructors

TableAttribute()

Creates new table mapping attribute.

public TableAttribute()

TableAttribute(string)

Creates new table mapping attribute.

public TableAttribute(string tableName)

Parameters

tableName string

Name of mapped table or view in database.

Properties

Database

Gets or sets optional database name, to override default database name. See DatabaseName<T>(ITable<T>, string?) method for support information per provider.

public string? Database { get; set; }

Property Value

string

IsColumnAttributeRequired

Gets or sets column mapping rules for current class or interface. If true, properties and fields should be marked with one of those attributes to be used for mapping:

public bool IsColumnAttributeRequired { get; set; }

Property Value

bool

IsTemporary

Gets or sets IsTemporary flag. See IsTemporary<T>(ITable<T>, bool) method for support information per provider.

public bool IsTemporary { get; set; }

Property Value

bool

IsView

This property is not used by linq2db and could be used for informational purposes.

public bool IsView { get; set; }

Property Value

bool

Name

Gets or sets name of table or view in database. When not specified, name of class or interface will be used.

public string? Name { get; set; }

Property Value

string

Schema

Gets or sets optional schema/owner name, to override default name. See SchemaName<T>(ITable<T>, string?) method for support information per provider.

public string? Schema { get; set; }

Property Value

string

Server

Gets or sets optional linked server name. See ServerName<T>(ITable<T>, string?) method for support information per provider.

public string? Server { get; set; }

Property Value

string

TableOptions

Gets or sets Table options. See TableOptions enum for support information per provider.

public TableOptions TableOptions { get; set; }

Property Value

TableOptions

Methods

GetObjectID()

Returns mapping attribute id, based on all attribute options.

public override string GetObjectID()

Returns

string