Search Results for

    Show / Hide Table of Contents

    Class DataContext

    Represents the class that manages access to meta data.

    Inheritance
    System.Object
    DynamicObject
    DataContext
    Implements
    System.Dynamic.IDynamicMetaObjectProvider
    IDataContext
    System.IDisposable
    Inherited Members
    DynamicObject.SetMember(String, Object)
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: TimeCockpit.Data
    Assembly: TimeCockpit.Data.dll
    Syntax
    public sealed class DataContext : DynamicObject, IDynamicMetaObjectProvider, IDataContext, IDisposable
    Remarks

    The DataContext provides functionality to query or manipulate an underlying datastore. This applies to both, the data and meta model. That is, users can insert, update or delete data or can change the structure of the data via the belonging Model.

    Properties

    DataContextType

    Gets the DataContextType of the current instance of DataContext.

    Declaration
    public DataContextType DataContextType { get; }
    Property Value
    Type Description
    DataContextType
    Remarks

    The type of the data context may either be DataContextType.Client or DataContextType.Server. When a DataContext is instantiated with DataContext.Client no writable Model can be requested from the Model. That is, no changes to the meta data of a DataContext can be made. In contrast to that, a DataContext that has been instantiated with DataContext.Server can request a writable Model. See also TimeCockpit.Data.DataContext.GetWritableModel(System.Boolean)

    DbClient

    Gets the reference to the underlying DbClient object.

    Declaration
    public DbClient DbClient { get; }
    Property Value
    Type Description
    DbClient
    Remarks

    The DbClient it the executing unit that performs all data access via the current instance of the DataContext

    Exceptions
    Type Condition
    System.ArgumentNullException

    Thrown if it is tried to set the property to null.

    Environment

    Gets the environment for the current instance of DataContext.

    Declaration
    public Environment Environment { get; }
    Property Value
    Type Description
    Environment
    Implements
    IDataContext.Environment

    Localizer

    Gets the localization implementation that is used.

    Declaration
    public NameLocalizer Localizer { get; }
    Property Value
    Type Description
    NameLocalizer

    Model

    Gets the Model associated with this context.

    Declaration
    public Model Model { get; }
    Property Value
    Type Description
    Model
    Remarks

    The Model of an instance of a DataContext represents the meta data storage of the current DataContext. It describes how the data that can be accessed with the current instance looks like.

    Methods

    Create(String, String)

    Creates a new instance of the DataContext class based on the specified DataContextSettings and on the connection information fetched from the management service.

    Declaration
    public static DataContext Create(string userName, string password)
    Parameters
    Type Name Description
    System.String userName

    The username to access the management webservice.

    System.String password

    The password to access the management webservice.

    Returns
    Type Description
    DataContext

    New instance of the DataContext class.

    Remarks

    This method fetches an instance of WebManagementService.ConnectionInformation from the management service to determine where to connect to. Thus it can only create a data context to a remote sql azure database, that is, an instance of a DataContext with type Server.

    Exceptions
    Type Condition
    System.ArgumentException

    Create(String, String, String)

    Creates a new instance of the DataContext class based on the specified DataContextSettings and on the connection information fetched from the management service.

    Declaration
    public static DataContext Create(string userName, string password, string endpointName)
    Parameters
    Type Name Description
    System.String userName

    The username to access the management webservice.

    System.String password

    The password to access the management webservice.

    System.String endpointName

    The name of the service endpoint where to access the management service.

    Returns
    Type Description
    DataContext

    New instance of the DataContext class.

    Remarks

    This method fetches an instance of WebManagementService.ConnectionInformation from the management service to determine where to connect to. Thus it can only create a data context to a remote sql azure database, that is, an instance of a DataContext with type Server.

    Exceptions
    Type Condition
    System.ArgumentException

    Create(String, String, String, String)

    Creates a new instance of the DataContext class based on the specified DataContextSettings and on the connection information fetched from the management service.

    Declaration
    public static DataContext Create(string userName, string password, string endpointName, string endpointAddress)
    Parameters
    Type Name Description
    System.String userName

    The username to access the management webservice.

    System.String password

    The password to access the management webservice.

    System.String endpointName

    The name of the service endpoint where to access the management service.

    System.String endpointAddress

    The address of the endpoint.

    Returns
    Type Description
    DataContext

    New instance of the DataContext class.

    Remarks

    This method fetches an instance of WebManagementService.ConnectionInformation from the management service to determine where to connect to. Thus it can only create a data context to a remote sql azure database, that is, an instance of a DataContext with type Server.

    Exceptions
    Type Condition
    System.ArgumentException

    Create(String, String, String, DataContextSettings, String)

    Creates a new instance of the DataContext class based on the specified DataContextSettings and on the connection information fetched from the management service.

    Declaration
    public static DataContext Create(string userName, string password, string endpointName, DataContextSettings settings, string endpointAddress = null)
    Parameters
    Type Name Description
    System.String userName

    The username to access the management webservice.

    System.String password

    The password to access the management webservice.

    System.String endpointName

    The name of the service endpoint where to access the management service.

    DataContextSettings settings

    Settings that define the behavior of the created DataContext instance.

    System.String endpointAddress

    The address of the endpoint.

    Returns
    Type Description
    DataContext

    New instance of the DataContext class.

    Remarks

    This method fetches an instance of WebManagementService.ConnectionInformation from the management service to determine where to connect to. Thus it can only create a data context to a remote sql azure database, that is, an instance of a DataContext with type Server.

    ATTENTION: If either a provider name, connection string, a blob storage account name, a shared access key or a tenant schema was set in the settings.DbClientSettings parameter, the latter settings will overwritten with the data fetched from the management service. Further it creates a DataContext of type Server that is, changes are allowed.

    Exceptions
    Type Condition
    System.ArgumentException

    Create(DataContextSettings)

    Creates a new instance of the DataContext class based on the specified DataContextSettings.

    Declaration
    public static DataContext Create(DataContextSettings settings)
    Parameters
    Type Name Description
    DataContextSettings settings

    Settings that define the behavior of the created DataContext instance.

    Returns
    Type Description
    DataContext

    New instance of the DataContext class.

    Remarks

    This method to create a new instance of DataContext can be used to create either DataContexts of type Server or Client (local connection to Sql CE).

    This factory methods creates the DbClient to access the database and, if InstallMissingSystemObjects it true, install missing system object (or adds missing ones).

    Further, if InstallMissingSystemEntities is true, missing system entities are installed.

    Exceptions
    Type Condition
    System.ArgumentException

    DeleteObject(EntityObject)

    Deletes a given EntityObject.

    Declaration
    public void DeleteObject(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to delete.

    Remarks

    This method marks the instance EntityObject as deleted and subsequently calls SaveObject(EntityObject) for the object.

    DeleteObjectAsync(EntityObject)

    Deletes a given EntityObject.

    Declaration
    [Obsolete("Avoid until task based implementation becomes available.")]
    public IObservable<Unit> DeleteObjectAsync(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to save.

    Returns
    Type Description
    System.IObservable<System.Reactive.Unit>

    A instance of IConnectableObservable

    DisableAuditTrail()

    Disables the audit trail functionality for the current data context.

    Declaration
    public void DisableAuditTrail()

    DisableSystemMode()

    Sets the Model of a DataContext to a state where entities/properties that have either System or ApplicationSpecific cannot be changed anymore. This is the default behavior.

    Declaration
    public void DisableSystemMode()

    Dispose()

    Releases database connection.

    Declaration
    public void Dispose()
    Implements
    System.IDisposable.Dispose()

    EnableAuditTrail()

    Enables the audit trail functionality for the current data context.

    Declaration
    public void EnableAuditTrail()

    EnableSystemMode()

    Sets the Model of a DataContext to a state where entities/properties that have either System or ApplicationSpecific can be changed.

    Declaration
    public void EnableSystemMode()
    Remarks

    ATTENTION: Use the system model at your own risk and only if you know what you are doing! Changes to System or ApplicationSpecific may break the Model.

    A newly created DataContext is never in system mode! So nobody can temper with System or ApplicationSpecific entities accidentially.

    EnforceRefreshModel()

    Refreshes Model by reading it from the underlying metadata database

    Declaration
    public void EnforceRefreshModel()
    Remarks

    In contrast to RefreshModel() this method always reads the Model from the underlying metadata database regardless of the local model version. Therefore it can be used to throw away pending model changes in memory.

    ExecuteAction(ModelAction, ExecutionContext)

    Execute the given action.

    Declaration
    public ActionResult ExecuteAction(ModelAction action, ExecutionContext executionContext)
    Parameters
    Type Name Description
    ModelAction action

    Action to execute.

    ExecutionContext executionContext

    Execution context/parameters to use.

    Returns
    Type Description
    ActionResult

    Action result.

    Implements
    IDataContext.ExecuteAction(ModelAction, ExecutionContext)

    GetMember(String)

    Gets a dynamic member.

    Declaration
    public override object GetMember(string name)
    Parameters
    Type Name Description
    System.String name

    Name of the member or method to get.

    Returns
    Type Description
    System.Object

    Reference to the dynamic member.

    Overrides
    DynamicObject.GetMember(String)
    Remarks

    In most cases this method is used in dynamic language code. In a dynamic language, GetMember(String) must not be called on a DataContext. It suffices to call e.g. Context.Select(query). A lookup for the member with name "Select" is performed. Ths method provides access to the following members: Select(String, SelectCache), Select(String, IEnumerable<QueryParameter>, SelectCache), SelectSingle(String, SelectCache), SelectSingle(String, IEnumerable<QueryParameter>, SelectCache), SaveModel(Model), SaveObject(EntityObject), GetWritableModel(), RefreshModel(), , DbClient.BeginTransaction() and DbClient.TryCommitTransaction.

    Select methods that should be called with a list of parameters must end with the "WithParams" prfix in a dynamic language. So to call SelectSingle(String, IEnumerable<QueryParameter>, SelectCache) from a script the correct statement is SelectSingleWithParams(query, params).

    In order to create new instance of EntityObjects, this method provides a custom syntax. It suffices to call CreateModelEntityName in a dynamic language, whereas the prefix "Create" indicates that a new instance of the ModelEntityBase with the name "ModelEntityName" should be created. # create ModelEntity projectType = ModelEntity({ "Name": "Project", "InvariantFriendlyName": "Timecockpit Project" }) projectType.Properties.Add(TextProperty({ "Name": "ProjectName", "MaxStorageSize": 50, "InvariantFriendlyName":"Project Name" })) # create instance of ModelEntity instance = Context.CreateProject()

    GetMetaObject(Expression)

    Gets the data context meta object.

    Declaration
    public override DynamicMetaObject GetMetaObject(Expression parameter)
    Parameters
    Type Name Description
    System.Linq.Expressions.Expression parameter

    Expression parameter.

    Returns
    Type Description
    System.Dynamic.DynamicMetaObject

    Meta object.

    Overrides
    DynamicObject.GetMetaObject(Expression)

    GetScriptListResultAsync(ScriptListRequest)

    Gets the result of a script source list.

    Declaration
    public Task<EntityObject[]> GetScriptListResultAsync(ScriptListRequest request)
    Parameters
    Type Name Description
    ScriptListRequest request

    Request: List name, parameters ...

    Returns
    Type Description
    System.Threading.Tasks.Task<EntityObject[]>

    Returns the task representing the operation and containing the result entity objects.

    Implements
    IDataContext.GetScriptListResultAsync(ScriptListRequest)

    GetScriptResultByListName(String, String, IEnumerable<QueryParameter>, String)

    Selects the name of the by list.

    Declaration
    public ICollection<EntityObject> GetScriptResultByListName(string listName, string methodName, IEnumerable<QueryParameter> queryParameters, string condition = null)
    Parameters
    Type Name Description
    System.String listName

    Name of the list.

    System.String methodName

    Name of the method.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    The query parameters.

    System.String condition

    Additional query condition.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects.

    GetScriptResultModelEntityByListName(String, String)

    Gets the result model entity for the specified list.

    Declaration
    public ModelEntityBase GetScriptResultModelEntityByListName(string listName, string methodName)
    Parameters
    Type Name Description
    System.String listName

    Name of the list.

    System.String methodName

    Name of the method.

    Returns
    Type Description
    ModelEntityBase

    A list of EntityObjects.

    GetSettings(ConnectionInformation, DataContextSettings)

    TODO review/preview

    Declaration
    public static DataContextSettings GetSettings(ConnectionInformation connectionInformation, DataContextSettings settings)
    Parameters
    Type Name Description
    WebManagementService.ConnectionInformation connectionInformation
    DataContextSettings settings
    Returns
    Type Description
    DataContextSettings

    GetVersionInformation(String, String, String, String)

    Gets the version information for the current user/tenant.

    Declaration
    public static VersionInformationOverview GetVersionInformation(string userName, string password, string endpointName, string endpointAddress = null)
    Parameters
    Type Name Description
    System.String userName

    The username to access the management webservice.

    System.String password

    The password to access the management webservice.

    System.String endpointName

    The name of the service endpoint where to access the management service.

    System.String endpointAddress

    The address of the endpoint to use.

    Returns
    Type Description
    WebManagementService.VersionInformationOverview

    The version information for the current user/tenant or null if the user uses a deprecated (pre-ownership) tenant.

    GetWritableModel()

    Gets a Model from the metadata repository database that is not frozen (i.e. that can be changed)

    Declaration
    public Model GetWritableModel()
    Returns
    Type Description
    Model

    An instance of Model where metadata can be changed.

    Exceptions
    Type Condition
    System.InvalidOperationException

    InitializeLocalizedTextValues(EntityObject)

    Initializes the localized text values.

    Declaration
    public void InitializeLocalizedTextValues(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The entity object to initialize the localized text value collection for.

    Remarks

    If called, the method creates the structure to store localized text values of a new entity object. If the method is called on an EntityObject that has been loaded from the database the method throws an System.InvalidOperationException.

    IsDirty(EntityObject)

    Checks if an EntityObject has changed since it has been loaded from the database.

    Declaration
    public bool IsDirty(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to check.

    Returns
    Type Description
    System.Boolean

    True if the EntityObject has been changed since it has been loaded from the database else false.

    ReadLocalizedTextValues(EntityObject)

    Reads the localized text values for all localized properties of the underlying ModelEntityBase of the EntityObject.

    Declaration
    public void ReadLocalizedTextValues(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The entity object.

    RefreshEnvironment()

    Refreshes the environment.

    Declaration
    public void RefreshEnvironment()
    Implements
    IDataContext.RefreshEnvironment()

    RefreshModel()

    Refreshes the Model by reading it from the underlying metadata database

    Declaration
    public void RefreshModel()
    Implements
    IDataContext.RefreshModel()
    Remarks

    Before reading the Model from the database the system verifies that the Model in the database has changed. This is done by comparing the local model version from the database with the property LocalModelVersion from Model.

    SaveChanges(ChangeTracker)

    The method takes an instance of a ChangeTracker and persists the EntityObjects that have been tracked by the instance. The method persists both, add/update or delete operations.

    Declaration
    public int SaveChanges(ChangeTracker tracker)
    Parameters
    Type Name Description
    ChangeTracker tracker

    The tracker.

    Returns
    Type Description
    System.Int32

    An int that indicates how many changes have been saved

    SaveChangesAsync(ChangeTracker)

    Saves a given EntityObject.

    Declaration
    [Obsolete("Avoid until task based implementation becomes available.")]
    public IObservable<int> SaveChangesAsync(ChangeTracker tracker)
    Parameters
    Type Name Description
    ChangeTracker tracker

    The tracker for which to save the content.

    Returns
    Type Description
    System.IObservable<System.Int32>

    A instance of IConnectableObservable

    SaveModel(Model)

    Saves all Model.PendingOperations in the underlying model.

    Declaration
    public void SaveModel(Model model)
    Parameters
    Type Name Description
    Model model

    The Model to save.

    SaveModelIfValid(Model)

    Saves all Model.PendingOperations in the underlying model after validating that the model is valid.

    Declaration
    public void SaveModelIfValid(Model model)
    Parameters
    Type Name Description
    Model model

    The Model to save.

    Remarks

    Please be aware that a model might already be invalid before the currently pending operations were enqueued. If there is no guarantee/check that the initial model was valid, this method might throw a ValidationException even though the currently pending operations did not cause new issues.

    SaveObject(EntityObject)

    Saves a given EntityObject.

    Declaration
    public void SaveObject(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to save.

    SaveObject(EntityObject, SaveSettings)

    Saves a given EntityObject.

    Declaration
    public void SaveObject(EntityObject entityObject, SaveSettings settings)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to save.

    SaveSettings settings

    Settings to use for the save operation.

    SaveObjectAsync(EntityObject)

    Saves a given EntityObject.

    Declaration
    [Obsolete("Avoid until task based implementation becomes available.")]
    public IObservable<Unit> SaveObjectAsync(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The EntityObject to save.

    Returns
    Type Description
    System.IObservable<System.Reactive.Unit>

    A instance of IConnectableObservable

    Select(String, IEnumerable<QueryParameter>, SelectCache)

    Executes a query with query parameters.

    Declaration
    public ICollection<EntityObject> Select(string query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    A list of System.Collections.Generic.IEnumerable<T>

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects

    Select(String, SelectCache)

    Executes a query

    Declaration
    public ICollection<EntityObject> Select(string query, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects.

    Select(Query, IEnumerable<QueryParameter>, SelectCache)

    Executes a query with query parameters by passing in an AST tree.

    Declaration
    public ICollection<EntityObject> Select(Query query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    Query query

    Query to execute as an AST representation.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    A list of System.Collections.Generic.IEnumerable<T>

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects

    Select(Query, SelectCache)

    Executes a query passed as an AST.

    Declaration
    public ICollection<EntityObject> Select(Query query, SelectCache cache = null)
    Parameters
    Type Name Description
    Query query

    The query to select.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    Returns a list of EntityObjects.

    SelectAsync(String, IEnumerable<QueryParameter>, SelectCache)

    Invokes the Select(String, IEnumerable<QueryParameter>, SelectCache) asynchronously

    Declaration
    public IObservable<EntityObject> SelectAsync(string query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    a TCQL query

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    a list of QueryParameters

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    An connectable observable of EntityObjects.

    SelectAsync(String, SelectCache)

    Invokes the Select(String, SelectCache) method asynchronously

    Declaration
    [Obsolete("Avoid until task based implementation becomes available.")]
    public IObservable<EntityObject> SelectAsync(string query, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    a TCQL query

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    returns a connectable observable producing the entity objects returned by the query.

    SelectAsync(Query, IEnumerable<QueryParameter>, SelectCache)

    Invokes the asynchronously.

    Declaration
    public IObservable<EntityObject> SelectAsync(Query query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    Query query

    The AST representation of a Query.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    a list of QueryParameters

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    An connectable observable of EntityObjects.

    SelectMultipleAsync(QueryRequest[], CancellationToken)

    Issues multiple queries.

    Declaration
    public Task SelectMultipleAsync(QueryRequest[] queries, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    QueryRequest[] queries

    The queries to execute.

    System.Threading.CancellationToken cancellationToken

    The cancellation token to cancel requests.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns the tasks producing the results of the queries, in corresponding order.

    SelectSingle(String, IEnumerable<QueryParameter>, SelectCache)

    Executes a query with a list of QueryParameters and returns the first row of the result set

    Declaration
    public EntityObject SelectSingle(string query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    A list of System.Collections.Generic.IEnumerable<T>.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    A list of EntityObjects.

    SelectSingle(String, SelectCache)

    Executes a query and returns the first row of the result set.

    Declaration
    public EntityObject SelectSingle(string query, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    A single instance of EntityObject.

    SelectSingle(IEntityObject, Boolean, SelectCache)

    Executes a query by example and returns the first row of the result set

    Declaration
    public EntityObject SelectSingle(IEntityObject entityObject, bool autoIncludeRelations, SelectCache cache = null)
    Parameters
    Type Name Description
    IEntityObject entityObject

    The example EntityObject to query for.

    System.Boolean autoIncludeRelations

    If true, fetches the all relations of the EntityObject

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    A single instance of EntityObject.

    Remarks

    This method returns the all relations of the returned EntityObject. That is, if an EntityObject has a relation to another EntityObject and the referenced EntityObject has a value, the value will be returned.

    SelectSingle(IEntityObject, SelectCache)

    Executes a query by example and returns the first row of the result set

    Declaration
    public EntityObject SelectSingle(IEntityObject entityObject, SelectCache cache = null)
    Parameters
    Type Name Description
    IEntityObject entityObject

    The example EntityObject to query for.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    An instance of EntityObject.

    Remarks

    This does not fetch include relations in the query. That is, if an EntityObject has a relation to another EntityObject, the value of the referenced EntityObject will be null.

    SelectSingle(Query, IEnumerable<QueryParameter>, SelectCache)

    Executes a query returning a single element.

    Declaration
    public EntityObject SelectSingle(Query query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    Query query

    The query to execute.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    The query parameters to execute.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    Returns the entity object returned by the query.

    SelectSingle(Query, SelectCache)

    Executes a query and returns the first row of the result set.

    Declaration
    public EntityObject SelectSingle(Query query, SelectCache cache = null)
    Parameters
    Type Name Description
    Query query

    Query to execute.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    EntityObject

    A single instance of EntityObject.

    SelectSingleAsync(String, IEnumerable<QueryParameter>, SelectCache)

    Invokes the SelectSingle(String, IEnumerable<QueryParameter>, SelectCache) asynchronously

    Declaration
    public IObservable<EntityObject> SelectSingleAsync(string query, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    a TCQL query

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    a list of QueryParameters

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    Returns a connectable observable of EntityObjects.

    SelectSingleAsync(String, SelectCache)

    Invokes the SelectSingle(String, SelectCache) method asynchronously

    Declaration
    public IObservable<EntityObject> SelectSingleAsync(string query, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    a TCQL query

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    Returns a connectable observable of EntityObjects.

    SelectSingleAsync(IEntityObject)

    Executes a query by example and returns the first row of the result set

    Declaration
    public IObservable<EntityObject> SelectSingleAsync(IEntityObject entityObject)
    Parameters
    Type Name Description
    IEntityObject entityObject

    The example EntityObject to query for.

    Returns
    Type Description
    System.IObservable<EntityObject>

    An instance of EntityObject.

    Remarks

    This does not fetch include relations in the query. That is, if an EntityObject has a relation to another EntityObject, the value of the referenced EntityObject will be null.

    SelectSingleAsync(IEntityObject, Boolean, SelectCache)

    Executes a query by example and returns the first row of the result set

    Declaration
    public IObservable<EntityObject> SelectSingleAsync(IEntityObject entityObject, bool autoIncludeRelations, SelectCache cache = null)
    Parameters
    Type Name Description
    IEntityObject entityObject

    The example EntityObject to query for.

    System.Boolean autoIncludeRelations

    If true, fetches the all relations of the EntityObject

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    A single instance of EntityObject.

    Remarks

    This method returns the all relations of the returned EntityObject. That is, if an EntityObject has a relation to another EntityObject and the referenced EntityObject has a value, the value will be returned.

    SelectSingleAsync(Query, IEnumerable<QueryParameter>)

    Invokes the asynchronously.

    Declaration
    public IObservable<EntityObject> SelectSingleAsync(Query query, IEnumerable<QueryParameter> queryParameters)
    Parameters
    Type Name Description
    Query query

    The AST representation of a Query.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    a list of QueryParameters

    Returns
    Type Description
    System.IObservable<EntityObject>

    An connectable observable producing an EntityObject.

    SelectSingleWithParameters(IEnumerable<KeyValuePair<Object, Object>>)

    Executes a query with query parameters and returns the first row of the result set

    Declaration
    public EntityObject SelectSingleWithParameters(IEnumerable<KeyValuePair<object, object>> parameters)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> parameters

    A list of System.Collections.Generic.KeyValuePair<TKey, TValue>.

    Returns
    Type Description
    EntityObject

    A single instance of EntityObject.

    SelectSingleWithParametersAsync(IEnumerable<KeyValuePair<Object, Object>>)

    Execute a query with query parameters asynchronously and returns an observable to the first row of the result set.

    Declaration
    public IObservable<EntityObject> SelectSingleWithParametersAsync(IEnumerable<KeyValuePair<object, object>> parameters)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> parameters

    A list of System.Collections.Generic.KeyValuePair<TKey, TValue>.

    Returns
    Type Description
    System.IObservable<EntityObject>

    An observable to a single instance of EntityObjects

    SelectTop(String, Int32, IEnumerable<QueryParameter>, SelectCache)

    Executes a query with a list of QueryParameters and returns a specified number of rows.

    Declaration
    public ICollection<EntityObject> SelectTop(string query, int rowCount, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute.

    System.Int32 rowCount

    The number rows to return.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    A list of System.Collections.Generic.IEnumerable<T>.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects

    SelectTop(String, Int32, SelectCache)

    Executes a query but returns only the specified number of rows.

    Declaration
    public ICollection<EntityObject> SelectTop(string query, int rowCount, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute.

    System.Int32 rowCount

    The number of rows to return.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects.

    SelectTopAsync(String, Int32, IEnumerable<QueryParameter>, SelectCache)

    Executes a query with a list of QueryParameters and returns a specified number of rows.

    Declaration
    public IObservable<EntityObject> SelectTopAsync(string query, int rowCount, IEnumerable<QueryParameter> queryParameters, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute.

    System.Int32 rowCount

    The number rows to return.

    System.Collections.Generic.IEnumerable<QueryParameter> queryParameters

    A list of System.Collections.Generic.IEnumerable<T>.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    Returns a connectable observable of EntityObjects.

    SelectTopAsync(String, Int32, SelectCache)

    Executes a query asynchronously but returns only the specified number of rows.

    Declaration
    public IObservable<EntityObject> SelectTopAsync(string query, int rowCount, SelectCache cache = null)
    Parameters
    Type Name Description
    System.String query

    Query to execute asynchronously.

    System.Int32 rowCount

    The number of rows to return.

    SelectCache cache

    The entity object cache for reusing entities.

    Returns
    Type Description
    System.IObservable<EntityObject>

    A list of EntityObjects.

    SelectWithParameters(IEnumerable<KeyValuePair<Object, Object>>)

    Executes a query with query parameters.

    Declaration
    public ICollection<EntityObject> SelectWithParameters(IEnumerable<KeyValuePair<object, object>> parameters)
    Parameters
    Type Name Description
    System.Collections.Generic.IEnumerable<System.Collections.Generic.KeyValuePair<System.Object, System.Object>> parameters

    A list of System.Collections.Generic.KeyValuePair<TKey, TValue>.

    Returns
    Type Description
    System.Collections.Generic.ICollection<EntityObject>

    A list of EntityObjects

    Explicit Interface Implementations

    IDataContext.DeleteObjectAsync(EntityObject)

    Asynchronously deletes an object.

    Declaration
    Task IDataContext.DeleteObjectAsync(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The id and type of the entity to delete.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns the task representing the operation.

    Implements
    IDataContext.DeleteObjectAsync(EntityObject)

    IDataContext.Localizer

    Gets the localizer.

    Declaration
    NameLocalizer IDataContext.Localizer { get; }
    Returns
    Type Description
    NameLocalizer
    Implements
    IDataContext.Localizer

    IDataContext.Model

    Gets the model of the context.

    Declaration
    Model IDataContext.Model { get; }
    Returns
    Type Description
    Model
    Implements
    IDataContext.Model

    IDataContext.SaveChangesAsync(ChangeTracker)

    Saves the changes from the change tracker to the data context.

    Declaration
    Task IDataContext.SaveChangesAsync(ChangeTracker changes)
    Parameters
    Type Name Description
    ChangeTracker changes

    The ChangeTracker holding the changed objects.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns the task representing the operation.

    Implements
    IDataContext.SaveChangesAsync(ChangeTracker)

    IDataContext.SaveObjectAsync(EntityObject)

    Saves an object to the data context.

    Declaration
    Task IDataContext.SaveObjectAsync(EntityObject entityObject)
    Parameters
    Type Name Description
    EntityObject entityObject

    The entity object to save.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns the task representing the operation.

    Implements
    IDataContext.SaveObjectAsync(EntityObject)

    IDataContext.SelectMultipleAsync(QueryRequest[], CancellationToken)

    Canonical method for querying a database with multiple queries at the same time.

    Declaration
    Task IDataContext.SelectMultipleAsync(QueryRequest[] queries, CancellationToken cancellationToken)
    Parameters
    Type Name Description
    QueryRequest[] queries

    The query request objects.

    System.Threading.CancellationToken cancellationToken

    A cancellation token used for all operations.

    Returns
    Type Description
    System.Threading.Tasks.Task

    Returns a list of tasks representing the query operations.

    Implements
    IDataContext.SelectMultipleAsync(QueryRequest[], CancellationToken)
    Remarks

    This interface is the lowest level interface and should support all scenarios required. Use the helper methods in to find an easier interface.

    Extension Methods

    DataContextScriptExtensions.ExecuteScript(DataContext, ExecutionInfo)
    DataContextScriptExtensions.ExecuteScript(DataContext, ExecutionInfo, Stream)
    DataContextScriptExtensions.ExecuteScriptReturnOutput(DataContext, ExecutionInfo)
    DataContextScriptExtensions.ExecuteScriptFromResource(DataContext, Assembly, String, Stream)
    DataContextScriptExtensions.GetScriptResult(DataContext, ExecutionInfo, Stream)
    DataContextScriptExtensions.GetFunctionScriptResult<T>(DataContext, ExecutionInfo, String, Object[], Stream)
    In This Article
    • Properties
      • DataContextType
      • DbClient
      • Environment
      • Localizer
      • Model
    • Methods
      • Create(String, String)
      • Create(String, String, String)
      • Create(String, String, String, String)
      • Create(String, String, String, DataContextSettings, String)
      • Create(DataContextSettings)
      • DeleteObject(EntityObject)
      • DeleteObjectAsync(EntityObject)
      • DisableAuditTrail()
      • DisableSystemMode()
      • Dispose()
      • EnableAuditTrail()
      • EnableSystemMode()
      • EnforceRefreshModel()
      • ExecuteAction(ModelAction, ExecutionContext)
      • GetMember(String)
      • GetMetaObject(Expression)
      • GetScriptListResultAsync(ScriptListRequest)
      • GetScriptResultByListName(String, String, IEnumerable<QueryParameter>, String)
      • GetScriptResultModelEntityByListName(String, String)
      • GetSettings(ConnectionInformation, DataContextSettings)
      • GetVersionInformation(String, String, String, String)
      • GetWritableModel()
      • InitializeLocalizedTextValues(EntityObject)
      • IsDirty(EntityObject)
      • ReadLocalizedTextValues(EntityObject)
      • RefreshEnvironment()
      • RefreshModel()
      • SaveChanges(ChangeTracker)
      • SaveChangesAsync(ChangeTracker)
      • SaveModel(Model)
      • SaveModelIfValid(Model)
      • SaveObject(EntityObject)
      • SaveObject(EntityObject, SaveSettings)
      • SaveObjectAsync(EntityObject)
      • Select(String, IEnumerable<QueryParameter>, SelectCache)
      • Select(String, SelectCache)
      • Select(Query, IEnumerable<QueryParameter>, SelectCache)
      • Select(Query, SelectCache)
      • SelectAsync(String, IEnumerable<QueryParameter>, SelectCache)
      • SelectAsync(String, SelectCache)
      • SelectAsync(Query, IEnumerable<QueryParameter>, SelectCache)
      • SelectMultipleAsync(QueryRequest[], CancellationToken)
      • SelectSingle(String, IEnumerable<QueryParameter>, SelectCache)
      • SelectSingle(String, SelectCache)
      • SelectSingle(IEntityObject, Boolean, SelectCache)
      • SelectSingle(IEntityObject, SelectCache)
      • SelectSingle(Query, IEnumerable<QueryParameter>, SelectCache)
      • SelectSingle(Query, SelectCache)
      • SelectSingleAsync(String, IEnumerable<QueryParameter>, SelectCache)
      • SelectSingleAsync(String, SelectCache)
      • SelectSingleAsync(IEntityObject)
      • SelectSingleAsync(IEntityObject, Boolean, SelectCache)
      • SelectSingleAsync(Query, IEnumerable<QueryParameter>)
      • SelectSingleWithParameters(IEnumerable<KeyValuePair<Object, Object>>)
      • SelectSingleWithParametersAsync(IEnumerable<KeyValuePair<Object, Object>>)
      • SelectTop(String, Int32, IEnumerable<QueryParameter>, SelectCache)
      • SelectTop(String, Int32, SelectCache)
      • SelectTopAsync(String, Int32, IEnumerable<QueryParameter>, SelectCache)
      • SelectTopAsync(String, Int32, SelectCache)
      • SelectWithParameters(IEnumerable<KeyValuePair<Object, Object>>)
    • Explicit Interface Implementations
      • IDataContext.DeleteObjectAsync(EntityObject)
      • IDataContext.Localizer
      • IDataContext.Model
      • IDataContext.SaveChangesAsync(ChangeTracker)
      • IDataContext.SaveObjectAsync(EntityObject)
      • IDataContext.SelectMultipleAsync(QueryRequest[], CancellationToken)
    • Extension Methods
    Back to top Copyright © 2020 software architects gmbh