Table of Contents

Class DataContextScriptHost

Namespace
TimeCockpit.Data
Assembly
TimeCockpit.Data.dll

class used for executing time cockpit python scripts.

public class DataContextScriptHost
Inheritance
Object
DataContextScriptHost
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

settings DebugSettings

Debug settings.

Properties

DefaultDebugSettings

Gets or sets the default debug settings.

public static DebugSettings DefaultDebugSettings { get; set; }

Property Value

DebugSettings

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

dataContext DataContext

dataContext to execute script against.

script ExecutionInfo

The script to execute.

inModelActionContext Boolean

Indicates whether the script is called from a ModelAction.

scriptScope ScriptScope

ScriptScope to use.

outputStream Stream

stream accepting output.

ExecuteScript(DataContext, ExecutionInfo, Boolean, Stream)

Executes a dlr script.

public void ExecuteScript(DataContext dataContext, ExecutionInfo script, bool inModelActionContext, Stream outputStream)

Parameters

dataContext DataContext

dataContext to execute script against.

script ExecutionInfo

The script to execute.

inModelActionContext Boolean

Indicates whether the script is called from a ModelAction.

outputStream Stream

stream accepting output.

ExecuteScript(DataContext, ExecutionInfo, Stream)

Executes a dlr script.

public void ExecuteScript(DataContext dataContext, ExecutionInfo script, Stream outputStream)

Parameters

dataContext DataContext

dataContext to execute script against.

script ExecutionInfo

The script to execute.

outputStream Stream

stream 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

dataContext DataContext

dataContext to pass to script for execution.

assembly Assembly

The assembly, that contains the embedded resource.

resourceName String

The name of the embedded resource.

outputStream Stream

stream 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

dataContext DataContext

datacontext to work against.

script ExecutionInfo

The script to execute.

functionName String

The name of the function to execute.

parameters Object[]

A list of parameters for the function.

scope ScriptScope

The scope to use.

outputStream Stream

stream accepting output.

Returns

T

An instance of ScriptResult

Type Parameters

T

Type 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

dataContext DataContext

datacontext to work against.

script ExecutionInfo

The script to execute.

scope ScriptScope

The scope to use.

outputStream Stream

stream 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.