Class Schema
Represents a schema or database.
Namespace: MySqlX.XDevAPI
Assembly: MySql.Data.dll
Version: 9.1.0
Syntax
public class Schema : DatabaseObject
Properties
Session
Session related to current schema.
Declaration
public BaseSession Session { get; }
Property Value
Type | Description |
---|---|
BaseSession |
Methods
CreateCollection(String, CreateCollectionOptions)
Creates a Collection including a schema validation.
Declaration
public Collection CreateCollection(string collectionName, CreateCollectionOptions options)
Parameters
Type | Name | Description |
---|---|---|
System.String | collectionName | The name of the collection to create. |
CreateCollectionOptions | options | This object hold the parameters required to create the collection. |
Returns
Type | Description |
---|---|
Collection | Collection referente. |
CreateCollection(String, Boolean)
Creates a Collection.
Declaration
public Collection CreateCollection(string collectionName, bool ReuseExisting = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | collectionName | The name of the collection to create. |
System.Boolean | ReuseExisting | If false, throws an exception if the collection exists. |
Returns
Type | Description |
---|---|
Collection | Collection referente. |
DropCollection(String)
Drops the given collection.
Declaration
public void DropCollection(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the collection to drop. |
Exceptions
Type | Condition |
---|---|
System.ArgumentNullException |
|
ExistsInDatabase()
Determines if this schema actually exists.
Declaration
public override bool ExistsInDatabase()
Returns
Type | Description |
---|---|
System.Boolean | True if exists, false otherwise. |
Overrides
GetCollection(String, Boolean)
Gets a collection by name.
Declaration
public Collection GetCollection(string name, bool ValidateExistence = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the collection to get. |
System.Boolean | ValidateExistence | Ensures the collection exists in the schema. |
Returns
Type | Description |
---|---|
Collection | A Collection object matching the given name. |
GetCollection<T>(String, Boolean)
Gets a typed collection object. This is useful for using domain objects.
Declaration
public Collection<T> GetCollection<T>(string name, bool ValidateExistence = false)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of collection to get. |
System.Boolean | ValidateExistence | Ensures the collection exists in the schema. |
Returns
Type | Description |
---|---|
Collection<T> | A generic Collection<T> object set with the given name. |
Type Parameters
Name | Description |
---|---|
T |
GetCollectionAsTable(String)
Gets the given collection as a table.
Declaration
public Table GetCollectionAsTable(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the collection. |
Returns
Type | Description |
---|---|
Table | A Table object set with the given name. |
GetCollections()
Returns a list of all collections in this schema.
Declaration
public List<Collection> GetCollections()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Collection> | A Collection list representing all found collections. |
GetTable(String)
Gets a table object. Upon return the object may or may not be valid.
Declaration
public Table GetTable(string name)
Parameters
Type | Name | Description |
---|---|---|
System.String | name | The name of the table object. |
Returns
Type | Description |
---|---|
Table | A Table object set with the given name. |
GetTables()
Returns a list of all tables in this schema.
Declaration
public List<Table> GetTables()
Returns
Type | Description |
---|---|
System.Collections.Generic.List<Table> | A Table list representing all found tables. |
ModifyCollection(String, Nullable<ModifyCollectionOptions>)
Modify a collection adding or removing schema validation parameters.
Declaration
public Collection ModifyCollection(string collectionName, ModifyCollectionOptions? options)
Parameters
Type | Name | Description |
---|---|---|
System.String | collectionName | The name of the collection to create. |
System.Nullable<ModifyCollectionOptions> | options | This object encapsulate the Validation parameters level and schema. |
Returns
Type | Description |
---|---|
Collection | Collection referente. |