Class Environment
Represents the gateway to information that should be available throughout the datalayer.
Inheritance
Inherited Members
Namespace: TimeCockpit.Data
Assembly: TimeCockpit.Data.dll
Syntax
public class Environment
Remarks
An instance of Environment is attatched to an instance of a DataContext. That is, the Environment is not global for the application life time, but the life time of a corresponding DataContext.
Constructors
Environment(IDataContext, EntityObject)
Initializes a new instance of the Environment class.
Declaration
public Environment(IDataContext context, EntityObject currentUser)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataContext | context | The parent DataContext to which the environment belongs. |
| EntityObject | currentUser | The current user under which the datacontext is running. |
Environment(IDataContext, EntityObject, EntityObject)
Initializes a new instance of the Environment class.
Declaration
public Environment(IDataContext context, EntityObject currentUser, EntityObject globalSettings)
Parameters
| Type | Name | Description |
|---|---|---|
| IDataContext | context | The parent DataContext to which the environment belongs. |
| EntityObject | currentUser | The current user under which the datacontext is running. |
| EntityObject | globalSettings | The global settings. |
Properties
CurrentUser
Gets the current user that uses the current instance of a DataContext
Declaration
public EntityObject CurrentUser { get; }
Property Value
| Type | Description |
|---|---|
| EntityObject |
GlobalSettings
Gets or sets the settings.
Declaration
public EntityObject GlobalSettings { get; set; }
Property Value
| Type | Description |
|---|---|
| EntityObject | The settings. |
Item[String]
Gets the System.Object with the specified property name.
Declaration
public object this[string propertyName] { get; }
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | propertyName | The name of the member to get the value for. |
Property Value
| Type | Description |
|---|---|
| System.Object | Returns the value of the specified member. |
NamedSets
Gets or sets the NamedSets that exist in the current instance Environment.
Declaration
public IDictionary<string, NamedSet> NamedSets { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IDictionary<System.String, NamedSet> |
ParentContext
Gets or sets the parent context.
Declaration
public IDataContext ParentContext { get; set; }
Property Value
| Type | Description |
|---|---|
| IDataContext | The parent context. |
Methods
GetNamedSet(String)
Get named set.
Declaration
public NamedSet GetNamedSet(string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the NamedSet to search for. |
Returns
| Type | Description |
|---|---|
| NamedSet | true if the NamedSet with the name is found, else false |
Remarks
If the set with the name cannot be found, the method return null.
RefreshEveryQuerySets()
Refreshes the every query sets.
Declaration
public void RefreshEveryQuerySets()
RefreshLogonSets(DataContext, Environment)
Refresh all (logon) named sets.
Declaration
public void RefreshLogonSets(DataContext context, Environment environment)
Parameters
| Type | Name | Description |
|---|---|---|
| DataContext | context | Context to use for refresh. |
| Environment | environment | The environment. |
TryGetNamedSet(String, out NamedSet)
Tries the get named set.
Declaration
public bool TryGetNamedSet(string name, out NamedSet namedSet)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | name | The name of the NamedSet to search for. |
| NamedSet | namedSet | The instance of NamedSet with the corresponding name. |
Returns
| Type | Description |
|---|---|
| System.Boolean | true if the NamedSet with the name is found, else false |