Class DBCursor
Represents a database cursor which enabled sync and async loading of data
Namespace: Simplic.Framework.DAL
Assembly: Simplic.Framework.DAL.dll
Syntax
public abstract class DBCursor : IDisposable
Constructors
| Improve this Doc View SourceDBCursor(DBCursorBehavior)
Initialize an instance of DBCursor
Declaration
public DBCursor(DBCursorBehavior behavior)
Parameters
| Type | Name | Description |
|---|---|---|
| DBCursorBehavior | behavior | configuration behavior for the DBCursor instance |
Properties
| Improve this Doc View SourceColumnList
Current column list
Declaration
public IList<string> ColumnList { get; }
Property Value
| Type | Description |
|---|---|
| IList<System.String> |
Columns
Current Columns
Declaration
public IDictionary<string, Type> Columns { get; }
Property Value
| Type | Description |
|---|---|
| IDictionary<System.String, Type> |
CurrentRowCount
current rowcount, increased by Fetch() method
Declaration
public int CurrentRowCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
EndOfResult
indicates if the cursor reached the end of the underlying sql statement
Declaration
public bool EndOfResult { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
FilterColumns
Columns which should be used for filtering unique values
Declaration
public string[] FilterColumns { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String[] |
PreparedRowsCount
currently prepared row count to fetch
Declaration
public int PreparedRowsCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
PreparedSqlStatement
Last executed and prepared statement
Declaration
public string PreparedSqlStatement { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
ResultTable
Resulttable contains all fetched rows
Declaration
public ObservableDataTable ResultTable { get; }
Property Value
| Type | Description |
|---|---|
| ObservableDataTable |
RowCollection
Access underlying data via ObservableCollection
Declaration
public RadObservableCollection<DataRow> RowCollection { get; }
Property Value
| Type | Description |
|---|---|
| RadObservableCollection<DataRow> |
TotalRowCount
contains a number which represents the maximum rowcount given by current statement
Declaration
public int? TotalRowCount { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.Int32> |
Methods
| Improve this Doc View SourceAddColumnSplitter(String, String)
Split column by character to group or ungroup data
Declaration
public void AddColumnSplitter(string column, string character)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | column | |
| System.String | character |
AddColumnSplitterAsync(String, String)
Split column by character to group or ungroup data
Declaration
public async Task AddColumnSplitterAsync(string column, string character)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | column | |
| System.String | character |
Returns
| Type | Description |
|---|---|
| Task |
AddRow(IDictionary<String, Object>)
Add data row from dictionary
Declaration
public void AddRow(IDictionary<string, object> row)
Parameters
| Type | Name | Description |
|---|---|---|
| IDictionary<System.String, System.Object> | row | Row values |
CancelLoading()
cancels the current loading task
Declaration
public void CancelLoading()
Clear(Boolean)
deletes cached statements and dataset, closes the db connection used in Open() method
Declaration
public void Clear(bool ingoreInPlace)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | ingoreInPlace |
ConvertRowsToListDict(IList<DataRow>, Boolean)
converts a datarow collection to a list of dictionaries which contains the column header + value pairs
Declaration
public IList<IDictionary<string, string>> ConvertRowsToListDict(IList<DataRow> datarows, bool toLower = false)
Parameters
| Type | Name | Description |
|---|---|---|
| IList<DataRow> | datarows | |
| System.Boolean | toLower |
Returns
| Type | Description |
|---|---|
| IList<IDictionary<System.String, System.String>> |
ConvertRowToDict(DataRow, Boolean)
Converts a datarow into a dictionary
Declaration
public IDictionary<string, string> ConvertRowToDict(DataRow datarow, bool toLower = false)
Parameters
| Type | Name | Description |
|---|---|---|
| DataRow | datarow | |
| System.Boolean | toLower |
Returns
| Type | Description |
|---|---|
| IDictionary<System.String, System.String> |
Dispose()
IDisposable Member, calls the Clear() method
Declaration
public void Dispose()
Fetch(Int32, Boolean)
Fetches the next result rows, returns fetched rows adds the rows to the ObservableCollection
Declaration
public IEnumerable<DataRow> Fetch(int count = 1, bool suppressEvents = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | count | amount of rows to fetch |
| System.Boolean | suppressEvents |
Returns
| Type | Description |
|---|---|
| IEnumerable<DataRow> |
FetchAsync(Int32)
Fetches the next result rows asynchronous. Be careful when binding RowCollection you need to set the controls dispatcher first!
Declaration
public void FetchAsync(int counter = 1)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | counter | amount of rows to fetch |
FetchToEnd()
Fetches the sql statement to the end of the result
Declaration
public IEnumerable<DataRow> FetchToEnd()
Returns
| Type | Description |
|---|---|
| IEnumerable<DataRow> |
FetchToEndAsync()
Fetches the entire result to the end
Declaration
public void FetchToEndAsync()
GetAdapter()
Create new get dataadapter instance (provider specific)
Declaration
protected abstract DbDataAdapter GetAdapter()
Returns
| Type | Description |
|---|---|
| DbDataAdapter |
GetConnection(String)
Get a connection instance
Declaration
protected abstract DbConnection GetConnection(string connectionName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | connectionName |
Returns
| Type | Description |
|---|---|
| DbConnection |
IsConnectionError(DbException)
Check whether exception is cause by a connection error
Declaration
protected abstract bool IsConnectionError(DbException exception)
Parameters
| Type | Name | Description |
|---|---|---|
| DbException | exception |
Returns
| Type | Description |
|---|---|
| System.Boolean |
Open(String, String, Object[])
Opens a new cursor
Declaration
public void Open(string statement, string connectionName, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | statement | select statement to execute |
| System.String | connectionName | connection name |
| System.Object[] | parameters | select parameters |
OpenReader(DbCommand)
Open data reader
Declaration
protected abstract DbDataReader OpenReader(DbCommand command)
Parameters
| Type | Name | Description |
|---|---|---|
| DbCommand | command |
Returns
| Type | Description |
|---|---|
| DbDataReader |
PrepareStatement(String, IDictionary<String, Object>, Object[])
Build/Prepare statement
Declaration
protected abstract DbCommand PrepareStatement(string statement, IDictionary<string, object> namedParameters, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | statement | |
| IDictionary<System.String, System.Object> | namedParameters | |
| System.Object[] | parameters |
Returns
| Type | Description |
|---|---|
| DbCommand |
RemoveColumnSplitterAsnyc(String)
Remove a splitted column grom grouping and unaggregate all data
Declaration
public async Task RemoveColumnSplitterAsnyc(string column)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | column | Column which should be ungrouped |
Returns
| Type | Description |
|---|---|
| Task |
Events
| Improve this Doc View SourceBeforePreparingStatementEvent
before preparing statement, fires before the sql statement is executed
Declaration
public event DBCursor.BeforePreparingStatementHandler BeforePreparingStatementEvent
Event Type
| Type | Description |
|---|---|
| DBCursor.BeforePreparingStatementHandler |
DoneLoadingEvent
fires when the cursor is done loading (asynchronous mode)
Declaration
public event DBCursor.DoneLoadingEventHandler DoneLoadingEvent
Event Type
| Type | Description |
|---|---|
| DBCursor.DoneLoadingEventHandler |
StartLoadingEvent
fires when the cursor starts loading (asynchronous - mode)
Declaration
public event DBCursor.StartLoadingEventHandler StartLoadingEvent
Event Type
| Type | Description |
|---|---|
| DBCursor.StartLoadingEventHandler |