Class MsSqlDataStore
Implements MsSQL 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
MsSqlDataStore
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.MsSql.dll
Syntax
public class MsSqlDataStore : MsSqlDataStoreBase, ICRUDDataStoreImplementation, ICRUDDataStore, ICRUDOperations, ICRUDTransactionOperations, IDataStoreImplementation, IDataStore, IApplicationComponent, IDisposable, IConfigurable, IInstrumentable, IExternallyParameterized
Constructors
MsSqlDataStore(IApplicationComponent)
Declaration
public MsSqlDataStore(IApplicationComponent director)
Parameters
MsSqlDataStore(IApplicationComponent, String)
Declaration
public MsSqlDataStore(IApplicationComponent director, string connectString)
Parameters
MsSqlDataStore(IApplication)
Declaration
public MsSqlDataStore(IApplication app)
Parameters
MsSqlDataStore(IApplication, String)
Declaration
public MsSqlDataStore(IApplication app, string connectString)
Parameters
Type |
Name |
Description |
IApplication |
app |
|
System.String |
connectString |
|
Fields
SCRIPT_FILE_SUFFIX
Declaration
public const string SCRIPT_FILE_SUFFIX = ".msf.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(SqlConnection, SqlTransaction, Doc, IDataStoreKey)
Performs CRUD row deletion. Override to do custom deletion
Declaration
protected virtual int DoDelete(SqlConnection cnn, SqlTransaction transaction, Doc row, IDataStoreKey key = null)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Doc |
row |
|
IDataStoreKey |
key |
|
Returns
Type |
Description |
System.Int32 |
|
DoExecuteWithoutFetch(SqlConnection, SqlTransaction, Query[])
Performs CRUD execution of queries that do not return result set. Override to do custom Query interpretation
Declaration
protected virtual int DoExecuteWithoutFetch(SqlConnection cnn, SqlTransaction transaction, Query[] queries)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Query[] |
queries |
|
Returns
Type |
Description |
System.Int32 |
|
DoGetSchema(SqlConnection, SqlTransaction, Query)
Performs CRUD load without fetching data only returning schema. Override to do custom Query interpretation
Declaration
protected virtual Schema DoGetSchema(SqlConnection cnn, SqlTransaction transaction, Query query)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Query |
query |
|
Returns
DoInsert(SqlConnection, SqlTransaction, Doc, FieldFilterFunc)
Performs CRUD row insert. Override to do custom insertion
Declaration
protected virtual int DoInsert(SqlConnection cnn, SqlTransaction transaction, Doc row, FieldFilterFunc filter = null)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Doc |
row |
|
FieldFilterFunc |
filter |
|
Returns
Type |
Description |
System.Int32 |
|
DoLoad(SqlConnection, SqlTransaction, Query[], Boolean)
Performs CRUD load. Override to do custom Query interpretation
Declaration
protected virtual List<RowsetBase> DoLoad(SqlConnection cnn, SqlTransaction transaction, Query[] queries, bool oneDoc = false)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Query[] |
queries |
|
System.Boolean |
oneDoc |
|
Returns
Type |
Description |
System.Collections.Generic.List<RowsetBase> |
|
DoOpenCursor(SqlConnection, SqlTransaction, Query)
Performs CRUD load. Override to do custom Query interpretation
Declaration
protected virtual Cursor DoOpenCursor(SqlConnection cnn, SqlTransaction transaction, Query query)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Query |
query |
|
Returns
DoSave(SqlConnection, SqlTransaction, RowsetBase[])
Performs CRUD batch save. Override to do custom batch saving
Declaration
protected virtual int DoSave(SqlConnection cnn, SqlTransaction transaction, RowsetBase[] rowsets)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
RowsetBase[] |
rowsets |
|
Returns
Type |
Description |
System.Int32 |
|
DoUpdate(SqlConnection, SqlTransaction, Doc, IDataStoreKey, FieldFilterFunc)
Performs CRUD row update. Override to do custom update
Declaration
protected virtual int DoUpdate(SqlConnection cnn, SqlTransaction transaction, Doc row, IDataStoreKey key = null, FieldFilterFunc filter = null)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Doc |
row |
|
IDataStoreKey |
key |
|
FieldFilterFunc |
filter |
|
Returns
Type |
Description |
System.Int32 |
|
DoUpsert(SqlConnection, SqlTransaction, Doc, FieldFilterFunc)
Performs CRUD row upsert. Override to do custom upsertion
Declaration
protected virtual int DoUpsert(SqlConnection cnn, SqlTransaction transaction, Doc row, FieldFilterFunc filter = null)
Parameters
Type |
Name |
Description |
System.Data.SqlClient.SqlConnection |
cnn |
|
System.Data.SqlClient.SqlTransaction |
transaction |
|
Doc |
row |
|
FieldFilterFunc |
filter |
|
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