Interface IDataScope
XData operational scope
Inherited Members
Namespace: XData
Assembly: XData.docfx.dll
Syntax
public interface IDataScope : IDisposable
Properties
| Improve this Doc View SourceDefaultContext
Data scope default context
Declaration
string DefaultContext { get; }
Property Value
| Type | Description |
|---|---|
| String |
Layer
Data scope layer identity
Declaration
Guid Layer { get; }
Property Value
| Type | Description |
|---|---|
| Guid |
Security
Security session
Declaration
ISecuritySession Security { get; }
Property Value
| Type | Description |
|---|---|
| ISecuritySession |
Token
Data scope cancellation token
Declaration
CancellationToken Token { get; }
Property Value
| Type | Description |
|---|---|
| CancellationToken |
Methods
| Improve this Doc View SourceBeginTransaction(Boolean, IsolationLevel)
Begins single context transaction
Declaration
ITransaction BeginTransaction(bool read = false, IsolationLevel isolation = IsolationLevel.ReadCommitted)
Parameters
| Type | Name | Description |
|---|---|---|
| Boolean | read | Read only transaction |
| IsolationLevel | isolation | Transaction isolation level |
Returns
| Type | Description |
|---|---|
| ITransaction | Transaction wrapper |
Exceptions
| Type | Condition |
|---|---|
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataSqlException | SQL exceptions while beginning transaction. |
See Also
| Improve this Doc View SourceExecuteNonQuery(Query)
Execute SQL expression custom query with no result set
Declaration
QueryResult ExecuteNonQuery(Query query)
Parameters
| Type | Name | Description |
|---|---|---|
| Query | query | Custom query |
Returns
| Type | Description |
|---|---|
| QueryResult | Custom query affected rows and out parameters |
ExecuteScalar<TResult>(Query)
Execute SQL single value result custom query
Declaration
TResult ExecuteScalar<TResult>(Query query)
Parameters
| Type | Name | Description |
|---|---|---|
| Query | query | Custom query |
Returns
| Type | Description |
|---|---|
| TResult | Custom query single value result |
Type Parameters
| Name | Description |
|---|---|
| TResult | Result value type |
FillTable(Query, CommandBehavior)
Fill DataTable with custom query results
Declaration
DataTable FillTable(Query query, CommandBehavior behavior = CommandBehavior.Default)
Parameters
| Type | Name | Description |
|---|---|---|
| Query | query | Custom query |
| CommandBehavior | behavior | Query command behavior |
Returns
| Type | Description |
|---|---|
| DataTable | DataTable |
GetContext()
Returns context by name
Declaration
XDataContext GetContext()
Returns
| Type | Description |
|---|---|
| XDataContext | Context |
Exceptions
| Type | Condition |
|---|---|
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
GetDictionaryValue<T>(Expression<Func<T, Boolean>>, String, ISecuritySession, Variable[])
Returns dictionary value by find expression and cache result
Declaration
T GetDictionaryValue<T>(Expression<Func<T, bool>> findExpression, string alias = null, ISecuritySession security = null, params Variable[] variables)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Expression<Func<T, Boolean>> | findExpression | Expression to find value |
| String | alias | Repository alias |
| ISecuritySession | security | Security session |
| Variable[] | variables | Repository variables |
Returns
| Type | Description |
|---|---|
| T | Dictionary object |
Type Parameters
| Name | Description |
|---|---|
| T | Dictionary type |
Exceptions
| Type | Condition |
|---|---|
| XDataRuntimeException | |
| XDataRuntimeException | No original data found for object |
| XDataRuntimeException | findExpression parameter is null |
GetQuery<T>(TextReader, String, ISecuritySession)
Get query
Declaration
IDataQuery<T> GetQuery<T>(TextReader reader, string alias = null, ISecuritySession security = null)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| TextReader | reader | Serialized data reader |
| String | alias | Base repository alias |
| ISecuritySession | security | Security session |
Returns
| Type | Description |
|---|---|
| IDataQuery<T> | Data query |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Adapter logic error. |
| XDataRuntimeException | reader parameter can not be null |
GetRepository<T>(TextReader)
Get repository
Declaration
IRepository<T> GetRepository<T>(TextReader reader)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| TextReader | reader | Serialized data reader |
Returns
| Type | Description |
|---|---|
| IRepository<T> | Repository |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Adapter logic error. |
| XDataRuntimeException | reader parameter can not be null |
GetRepository<T>(String, ISecuritySession, Variable[])
Get repository
Declaration
IRepository<T> GetRepository<T>(string alias = null, ISecuritySession security = null, params Variable[] variables)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| String | alias | Data object alias |
| ISecuritySession | security | Security session |
| Variable[] | variables | Data object variables |
Returns
| Type | Description |
|---|---|
| IRepository<T> | Repository |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataQueryStructureException | no mapping found. |
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Custom logic error. |
GetRepository<T>(String, Variable[])
Get repository
Declaration
IRepository<T> GetRepository<T>(string alias = null, params Variable[] variables)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| String | alias | Data object alias |
| Variable[] | variables | Data object variables |
Returns
| Type | Description |
|---|---|
| IRepository<T> | Repository |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataQueryStructureException | no mapping found. |
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Custom logic error. |
GetRepository<T>(ISecuritySession, Variable[])
Get repository
Declaration
IRepository<T> GetRepository<T>(ISecuritySession security = null, params Variable[] variables)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| ISecuritySession | security | Security session |
| Variable[] | variables | Data object variables |
Returns
| Type | Description |
|---|---|
| IRepository<T> | Repository |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataQueryStructureException | no mapping found. |
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Custom logic error. |
GetRepository<T>(Variable[])
Get repository
Declaration
IRepository<T> GetRepository<T>(params Variable[] variables)
where T : class, IDataObject, new()
Parameters
| Type | Name | Description |
|---|---|---|
| Variable[] | variables | Data object variables |
Returns
| Type | Description |
|---|---|
| IRepository<T> | Repository |
Type Parameters
| Name | Description |
|---|---|
| T | Data object type |
Exceptions
| Type | Condition |
|---|---|
| XDataQueryStructureException | no mapping found. |
| XDataConfigurationException | XData configuration errors. |
| XDataAdapterException | XData adapter errors. |
| XDataAdapterException | Custom logic error. |
Reset()
Reset data scope caches
Declaration
void Reset()