Class MySqlDataStore
Implements MySQL general data store that auto-generates SQLs for record models and supports CRUD operations.
This class IS thread-safe load/save/delete operations
Inheritance
System.Object
MySqlDataStore
Implements
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
Assembly: Azos.MySql.dll
Syntax
public class MySqlDataStore : MySQLDataStoreBase, ICRUDDataStoreImplementation, ICRUDDataStore, ICRUDOperations, ICRUDTransactionOperations, IDataStoreImplementation, IDataStore, IApplicationComponent, IDisposable, IConfigurable, IInstrumentable, IExternallyParameterized
Constructors
MySqlDataStore(IApplicationComponent)
Declaration
public MySqlDataStore(IApplicationComponent director)
Parameters
MySqlDataStore(IApplicationComponent, String)
Declaration
public MySqlDataStore(IApplicationComponent director, string cs)
Parameters
MySqlDataStore(IApplication)
Declaration
public MySqlDataStore(IApplication app)
Parameters
MySqlDataStore(IApplication, String)
Declaration
public MySqlDataStore(IApplication app, string cs)
Parameters
Fields
SCRIPT_FILE_SUFFIX
Declaration
public const string SCRIPT_FILE_SUFFIX = ".mys.sql"
Field Value
Type |
Description |
System.String |
|
Properties
QueryResolver
Declaration
public ICRUDQueryResolver QueryResolver { get; }
Property Value
ScriptFileSuffix
Declaration
public string ScriptFileSuffix { get; }
Property Value
Type |
Description |
System.String |
|
StoreType
Declaration
public CRUDDataStoreType StoreType { get; }
Property Value
SupportsTransactions
Declaration
public bool SupportsTransactions { get; }
Property Value
Type |
Description |
System.Boolean |
|
SupportsTrueAsynchrony
Declaration
public bool SupportsTrueAsynchrony { get; }
Property Value
Type |
Description |
System.Boolean |
|
Methods
BeginTransaction(IsolationLevel, TransactionDisposeBehavior)
Declaration
public CRUDTransaction BeginTransaction(IsolationLevel iso = IsolationLevel.ReadCommitted, TransactionDisposeBehavior behavior = TransactionDisposeBehavior.CommitOnDispose)
Parameters
Returns
BeginTransactionAsync(IsolationLevel, TransactionDisposeBehavior)
Declaration
public Task<CRUDTransaction> BeginTransactionAsync(IsolationLevel iso = IsolationLevel.ReadCommitted, TransactionDisposeBehavior behavior = TransactionDisposeBehavior.CommitOnDispose)
Parameters
Returns
Declaration
public override void Configure(IConfigSectionNode node)
Parameters
Overrides
Delete(Doc, IDataStoreKey)
Declaration
public int Delete(Doc row, IDataStoreKey key = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DeleteAsync(Doc, IDataStoreKey)
Declaration
public Task<int> DeleteAsync(Doc row, IDataStoreKey key = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
DoDelete(MySqlConnection, MySqlTransaction, Doc, IDataStoreKey)
Performs CRUD row deletion. Override to do custom deletion
Declaration
protected virtual int DoDelete(MySqlConnection cnn, MySqlTransaction transaction, Doc row, IDataStoreKey key = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DoExecuteWithoutFetch(MySqlConnection, MySqlTransaction, Query[])
Performs CRUD execution of queries that do not return result set. Override to do custom Query interpretation
Declaration
protected virtual int DoExecuteWithoutFetch(MySqlConnection cnn, MySqlTransaction transaction, Query[] queries)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DoGetSchema(MySqlConnection, MySqlTransaction, Query)
Performs CRUD load without fetching data only returning schema. Override to do custom Query interpretation
Declaration
protected virtual Schema DoGetSchema(MySqlConnection cnn, MySqlTransaction transaction, Query query)
Parameters
Returns
DoInsert(MySqlConnection, MySqlTransaction, Doc, FieldFilterFunc)
Performs CRUD row insert. Override to do custom insertion
Declaration
protected virtual int DoInsert(MySqlConnection cnn, MySqlTransaction transaction, Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DoLoad(MySqlConnection, MySqlTransaction, Query[], Boolean)
Performs CRUD load. Override to do custom Query interpretation
Declaration
protected virtual List<RowsetBase> DoLoad(MySqlConnection cnn, MySqlTransaction transaction, Query[] queries, bool oneDoc = false)
Parameters
Returns
Type |
Description |
System.Collections.Generic.List<RowsetBase> |
|
DoOpenCursor(MySqlConnection, MySqlTransaction, Query)
Performs CRUD load. Override to do custom Query interpretation
Declaration
protected virtual Cursor DoOpenCursor(MySqlConnection cnn, MySqlTransaction transaction, Query query)
Parameters
Returns
DoSave(MySqlConnection, MySqlTransaction, RowsetBase[])
Performs CRUD batch save. Override to do custom batch saving
Declaration
protected virtual int DoSave(MySqlConnection cnn, MySqlTransaction transaction, RowsetBase[] rowsets)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DoUpdate(MySqlConnection, MySqlTransaction, Doc, IDataStoreKey, FieldFilterFunc)
Performs CRUD row update. Override to do custom update
Declaration
protected virtual int DoUpdate(MySqlConnection cnn, MySqlTransaction transaction, Doc row, IDataStoreKey key = null, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
DoUpsert(MySqlConnection, MySqlTransaction, Doc, FieldFilterFunc)
Performs CRUD row upsert. Override to do custom upsertion
Declaration
protected virtual int DoUpsert(MySqlConnection cnn, MySqlTransaction transaction, Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
ExecuteWithoutFetch(Query[])
Declaration
public int ExecuteWithoutFetch(params Query[] queries)
Parameters
Type |
Name |
Description |
Query[] |
queries |
|
Returns
Type |
Description |
System.Int32 |
|
ExecuteWithoutFetchAsync(Query[])
Declaration
public Task<int> ExecuteWithoutFetchAsync(params Query[] queries)
Parameters
Type |
Name |
Description |
Query[] |
queries |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
GetSchema(Query)
Declaration
public Schema GetSchema(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
GetSchemaAsync(Query)
Declaration
public Task<Schema> GetSchemaAsync(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<Schema> |
|
Insert(Doc, FieldFilterFunc)
Declaration
public int Insert(Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
InsertAsync(Doc, FieldFilterFunc)
Declaration
public Task<int> InsertAsync(Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
Load(Query[])
Declaration
public List<RowsetBase> Load(params Query[] queries)
Parameters
Type |
Name |
Description |
Query[] |
queries |
|
Returns
Type |
Description |
System.Collections.Generic.List<RowsetBase> |
|
LoadAsync(Query[])
Declaration
public Task<List<RowsetBase>> LoadAsync(params Query[] queries)
Parameters
Type |
Name |
Description |
Query[] |
queries |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Collections.Generic.List<RowsetBase>> |
|
LoadOneDoc(Query)
Declaration
public Doc LoadOneDoc(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
LoadOneDocAsync(Query)
Declaration
public Task<Doc> LoadOneDocAsync(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<Doc> |
|
LoadOneRowset(Query)
Declaration
public RowsetBase LoadOneRowset(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
LoadOneRowsetAsync(Query)
Declaration
public Task<RowsetBase> LoadOneRowsetAsync(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<RowsetBase> |
|
MakeScriptQueryHandler(QuerySource)
Declaration
public CRUDQueryHandler MakeScriptQueryHandler(QuerySource querySource)
Parameters
Returns
OpenCursor(Query)
Declaration
public Cursor OpenCursor(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
OpenCursorAsync(Query)
Declaration
public Task<Cursor> OpenCursorAsync(Query query)
Parameters
Type |
Name |
Description |
Query |
query |
|
Returns
Type |
Description |
System.Threading.Tasks.Task<Cursor> |
|
Save(RowsetBase[])
Declaration
public int Save(params RowsetBase[] rowsets)
Parameters
Returns
Type |
Description |
System.Int32 |
|
SaveAsync(RowsetBase[])
Declaration
public Task<int> SaveAsync(params RowsetBase[] rowsets)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
Update(Doc, IDataStoreKey, FieldFilterFunc)
Declaration
public int Update(Doc row, IDataStoreKey key = null, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
UpdateAsync(Doc, IDataStoreKey, FieldFilterFunc)
Declaration
public Task<int> UpdateAsync(Doc row, IDataStoreKey key = null, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
Upsert(Doc, FieldFilterFunc)
Declaration
public int Upsert(Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Int32 |
|
UpsertAsync(Doc, FieldFilterFunc)
Declaration
public Task<int> UpsertAsync(Doc row, FieldFilterFunc filter = null)
Parameters
Returns
Type |
Description |
System.Threading.Tasks.Task<System.Int32> |
|
Implements
System.IDisposable
Extension Methods