Class Table<TEntity>
A Linq IQueryProvider that represents a table in Cassandra
Inherited Members
Namespace: Cassandra.Data.Linq
Assembly: Cassandra.dll
Syntax
public class Table<TEntity> : CqlQuery<TEntity>, IStatement, IQueryable<TEntity>, IEnumerable<TEntity>, IOrderedQueryable, IQueryable, IEnumerable, ITable, IQueryProvider
Type Parameters
Name | Description |
---|---|
TEntity |
Constructors
Table(ISession)
Creates a new instance of the Linq IQueryProvider that represents a table in Cassandra using Global configuration.
Declaration
public Table(ISession session)
Parameters
Type | Name | Description |
---|---|---|
ISession | session | Session instance to be used to execute the statements |
Table(ISession, MappingConfiguration)
Creates a new instance of the Linq IQueryProvider that represents a table in Cassandra using the mapping configuration provided.
Fluent configuration or attributes can be used to define mapping information.
Declaration
public Table(ISession session, MappingConfiguration config)
Parameters
Type | Name | Description |
---|---|---|
ISession | session | Session instance to be used to execute the statements |
MappingConfiguration | config | Mapping configuration |
Remarks
In case no mapping information is defined, case-insensitive class and method names will be used.
Table(ISession, MappingConfiguration, string)
Creates a new instance of the Linq IQueryProvider that represents a table in Cassandra using the mapping configuration provided.
Use this constructor if you want to use a different table name than the one defined in the mapping configuration.
Fluent configuration or attributes can be used to define mapping information.
Declaration
public Table(ISession session, MappingConfiguration config, string tableName)
Parameters
Type | Name | Description |
---|---|---|
ISession | session | Session instance to be used to execute the statements |
MappingConfiguration | config | Mapping configuration |
string | tableName | Name of the table |
Remarks
In case no mapping information is defined, case-insensitive class and method names will be used.
Table(ISession, MappingConfiguration, string, string)
Creates a new instance of the Linq IQueryProvider that represents a table in Cassandra using the mapping configuration provided.
Use this constructor if you want to use a different table and keyspace names than the ones defined in the mapping configuration.
Fluent configuration or attributes can be used to define mapping information.
Declaration
public Table(ISession session, MappingConfiguration config, string tableName, string keyspaceName)
Parameters
Type | Name | Description |
---|---|---|
ISession | session | Session instance to be used to execute the statements |
MappingConfiguration | config | Mapping configuration |
string | tableName | Name of the table |
string | keyspaceName | Name of the keyspace were the table was created. |
Remarks
In case no mapping information is defined, case-insensitive class and method names will be used.
Properties
KeyspaceName
Gets the name of the keyspace used. If null, it uses the active session keyspace.
Declaration
public string KeyspaceName { get; }
Property Value
Type | Description |
---|---|
string |
Name
Gets the name of the Table in Cassandra
Declaration
public string Name { get; }
Property Value
Type | Description |
---|---|
string |
Methods
Create()
Declaration
public void Create()
CreateAsync()
Declaration
public Task CreateAsync()
Returns
Type | Description |
---|---|
Task |
CreateIfNotExists()
Declaration
public void CreateIfNotExists()
CreateIfNotExistsAsync()
Declaration
public Task CreateIfNotExistsAsync()
Returns
Type | Description |
---|---|
Task |
CreateQuery<TElement>(Expression)
Creates a CqlQuery<TEntity>
Declaration
public IQueryable<TElement> CreateQuery<TElement>(Expression expression)
Parameters
Type | Name | Description |
---|---|---|
Expression | expression |
Returns
Type | Description |
---|---|
IQueryable<TElement> |
Type Parameters
Name | Description |
---|---|
TElement |
GetEntityType()
Declaration
public Type GetEntityType()
Returns
Type | Description |
---|---|
Type |
GetSession()
Declaration
public ISession GetSession()
Returns
Type | Description |
---|---|
ISession |
GetTableType()
Declaration
public TableType GetTableType()
Returns
Type | Description |
---|---|
TableType |
Insert(TEntity)
Returns a new CqlInsert<TEntity> command. Use Execute() method to execute the query.
Declaration
public CqlInsert<TEntity> Insert(TEntity entity)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity |
Returns
Type | Description |
---|---|
CqlInsert<TEntity> |
Insert(TEntity, bool)
Returns a new CqlInsert<TEntity> command. Use Execute() method to execute the query.
Declaration
public CqlInsert<TEntity> Insert(TEntity entity, bool insertNulls)
Parameters
Type | Name | Description |
---|---|---|
TEntity | entity | The entity to insert |
bool | insertNulls | Determines if the query must be generated using
Use
Use |
Returns
Type | Description |
---|---|
CqlInsert<TEntity> |