Class DataContextScriptHost
- Namespace
- TimeCockpit.Data
- Assembly
- TimeCockpit.Data.dll
class used for executing time cockpit python scripts.
public class DataContextScriptHost
- Inheritance
-
ObjectDataContextScriptHost
- Inherited Members
-
Object.ToString()Object.Equals(Object)Object.Equals(Object, Object)Object.ReferenceEquals(Object, Object)Object.GetHashCode()Object.GetType()Object.MemberwiseClone()
Constructors
DataContextScriptHost(DebugSettings)
Initializes a new instance of the DataContextScriptHost class.
public DataContextScriptHost(DebugSettings settings = null)
Parameters
settingsDebugSettingsDebug settings.
Properties
DefaultDebugSettings
Gets or sets the default debug settings.
public static DebugSettings DefaultDebugSettings { get; set; }
Property Value
Methods
CreateScope()
Initializes a new script scope.
public ScriptScope CreateScope()
Returns
- ScriptScope
returns the script scope.
ExecuteScript(DataContext, ExecutionInfo, Boolean, ScriptScope, Stream)
Executes a dlr script.
public void ExecuteScript(DataContext dataContext, ExecutionInfo script, bool inModelActionContext, ScriptScope scriptScope, Stream outputStream)
Parameters
dataContextDataContextdataContext to execute script against.
scriptExecutionInfoThe script to execute.
inModelActionContextBooleanIndicates whether the script is called from a ModelAction.
scriptScopeScriptScopeScriptScope to use.
outputStreamStreamstream accepting output.
ExecuteScript(DataContext, ExecutionInfo, Boolean, Stream)
Executes a dlr script.
public void ExecuteScript(DataContext dataContext, ExecutionInfo script, bool inModelActionContext, Stream outputStream)
Parameters
dataContextDataContextdataContext to execute script against.
scriptExecutionInfoThe script to execute.
inModelActionContextBooleanIndicates whether the script is called from a ModelAction.
outputStreamStreamstream accepting output.
ExecuteScript(DataContext, ExecutionInfo, Stream)
Executes a dlr script.
public void ExecuteScript(DataContext dataContext, ExecutionInfo script, Stream outputStream)
Parameters
dataContextDataContextdataContext to execute script against.
scriptExecutionInfoThe script to execute.
outputStreamStreamstream accepting output.
ExecuteScriptFromResource(DataContext, Assembly, String, Stream)
Executes a dlr script, that is saved as embedded resource.
public void ExecuteScriptFromResource(DataContext dataContext, Assembly assembly, string resourceName, Stream outputStream)
Parameters
dataContextDataContextdataContext to pass to script for execution.
assemblyAssemblyThe assembly, that contains the embedded resource.
resourceNameStringThe name of the embedded resource.
outputStreamStreamstream accepting output.
Exceptions
- System.ArgumentException
Thrown if the resource cannot be loaded from the assembly.
GetFunctionScriptResult<T>(DataContext, ExecutionInfo, String, Object[], ScriptScope, Stream)
Executes a dlr script and returns an instance of ScriptResult.
public T GetFunctionScriptResult<T>(DataContext dataContext, ExecutionInfo script, string functionName, object[] parameters, ScriptScope scope, Stream outputStream)
where T : class
Parameters
dataContextDataContextdatacontext to work against.
scriptExecutionInfoThe script to execute.
functionNameStringThe name of the function to execute.
parametersObject[]A list of parameters for the function.
scopeScriptScopeThe scope to use.
outputStreamStreamstream accepting output.
Returns
- T
An instance of ScriptResult
Type Parameters
TType of the result
GetScriptResult(DataContext, ExecutionInfo, ScriptScope, Stream)
Executes a dlr script and returns an instance of ScriptResult.
public ScriptResult GetScriptResult(DataContext dataContext, ExecutionInfo script, ScriptScope scope, Stream outputStream)
Parameters
dataContextDataContextdatacontext to work against.
scriptExecutionInfoThe script to execute.
scopeScriptScopeThe scope to use.
outputStreamStreamstream accepting output.
Returns
- ScriptResult
An instance of ScriptResult
Examples
result = Context.SelectSingle("From P In Project Select P")
Remarks
ATTENTION: Per convetion the result of the script is only returned if it is assigned to a variable that starts with "result". Up to now, this method can only return a list of EntityObjects as result. Even if the actual result of the dynamic language script would be a single instance of EntityObject, the object is added to a list of EntityObject with the object being the only item in the list.