Class BaseSession
Represents a base class for a Session.
Implements
Namespace: MySqlX.XDevAPI
Assembly: MySql.Data.dll
Version: 9.0.0
Syntax
public abstract class BaseSession : IDisposable
Fields
_client
Declaration
protected readonly Client _client
Field Value
Type | Description |
---|---|
Client |
Properties
DefaultSchema
Gets the default schema provided when creating the session.
Declaration
public Schema DefaultSchema { get; }
Property Value
Type | Description |
---|---|
Schema |
Schema
Gets the currently active schema.
Declaration
public Schema Schema { get; protected set; }
Property Value
Type | Description |
---|---|
Schema |
Settings
Gets the connection settings for this session.
Declaration
public MySqlXConnectionStringBuilder Settings { get; }
Property Value
Type | Description |
---|---|
MySqlXConnectionStringBuilder |
Uri
Gets the connection uri representation of the connection options provided during the creation of the session.
Declaration
public string Uri { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Close()
Closes this session or releases it to the pool.
Declaration
public void Close()
Commit()
Commits the current transaction.
Declaration
public void Commit()
CreateSchema(String)
Creates a schema/database with the given name.
Declaration
public Schema CreateSchema(string schema)
Parameters
Type | Name | Description |
---|---|---|
String | schema | The name of the schema/database. |
Returns
Type | Description |
---|---|
Schema | A Schema object that matches the recently created schema/database. |
Dispose()
Disposes the current object. Code added to correctly implement the disposable pattern.
Declaration
public void Dispose()
Dispose(Boolean)
Disposes the current object. Disposes of the managed state if the flag is set to true.
Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type | Name | Description |
---|---|---|
Boolean | disposing | Flag to indicate if the managed state is to be disposed. |
DropSchema(String)
Drops the database/schema with the given name.
Declaration
public void DropSchema(string schema)
Parameters
Type | Name | Description |
---|---|---|
String | schema | The name of the schema. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
GetSchema(String)
Gets the schema with the given name.
Declaration
public Schema GetSchema(string schema)
Parameters
Type | Name | Description |
---|---|---|
String | schema | The name of the schema. |
Returns
Type | Description |
---|---|
Schema | A Schema object set with the provided schema name. |
GetSchemas()
Gets a list of schemas (or databases) in this session.
Declaration
public List<Schema> GetSchemas()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Schema> | A Schema list containing all existing schemas (or databases). |
ParseConnectionData(String, Client)
Parses the connection data.
Declaration
protected string ParseConnectionData(string connectionData, Client client = null)
Parameters
Type | Name | Description |
---|---|---|
String | connectionData | The connection string or connection URI. |
Client | client | A Client object. |
Returns
Type | Description |
---|---|
String | An updated connection string representation of the provided connection string or connection URI. |
ReleaseSavepoint(String)
Removes the named savepoint from the set of savepoints within the current transaction.
Declaration
public void ReleaseSavepoint(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the transaction savepoint. |
Rollback()
Rolls back the current transaction.
Declaration
public void Rollback()
RollbackTo(String)
Rolls back a transaction to the named savepoint without terminating the transaction.
Declaration
public void RollbackTo(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the transaction savepoint. |
SetSavepoint()
Sets a transaction savepoint with an autogenerated name.
Declaration
public string SetSavepoint()
Returns
Type | Description |
---|---|
String | The autogenerated name of the transaction savepoint. |
SetSavepoint(String)
Sets a named transaction savepoint.
Declaration
public string SetSavepoint(string name)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the transaction savepoint. |
Returns
Type | Description |
---|---|
String | The name of the transaction savepoint. |
StartTransaction()
Starts a new transaction.
Declaration
public void StartTransaction()