/// <summary> /// Copy constructor /// </summary> /// <param name="onContext">Context to copy from</param> public ONServiceContext(ONServiceContext onContext) : base(onContext) { TransactionStack = onContext.TransactionStack; OperationStack = onContext.OperationStack; ModifiedClass = new Dictionary <ONOid, ONAction>(onContext.ModifiedClass); AcceptedTriggers = onContext.AcceptedTriggers; ChangeDetectionElements = onContext.ChangeDetectionElements; NeedsVerification = onContext.NeedsVerification; InSharedContext = false; }
/// <summary> /// Copy constructor /// </summary> /// <param name="onContext">Context to copy from</param> public ONServiceContext(ONServiceContext onContext) : base(onContext) { TransactionStack = onContext.TransactionStack; OperationStack = onContext.OperationStack; ModifiedClass = new Dictionary<ONOid, ONAction>(onContext.ModifiedClass); AcceptedTriggers = onContext.AcceptedTriggers; ChangeDetectionElements = onContext.ChangeDetectionElements; NeedsVerification = onContext.NeedsVerification; InSharedContext = false; }
/// <summary> /// Throws the triggers that has been accepted /// </summary> public void ThrowAcceptedTriggers() { List <ONTrigger> lAcceptedTriggers = AcceptedTriggers; AcceptedTriggers = new List <ONTrigger>(); foreach (ONTrigger lOnTrigger in lAcceptedTriggers) { try { object[] lParameters = new object[lOnTrigger.InputParameters.Count + lOnTrigger.OutputParameters.Count]; int i = 0; ONInstance lThis = null; foreach (DictionaryEntry lDictionaryEntry in lOnTrigger.InputParameters) { lParameters[i++] = lDictionaryEntry.Value; if (string.Compare((lDictionaryEntry.Key as string), lOnTrigger.ArgumentThisName, true) == 0) { lThis = (lDictionaryEntry.Value as ONOid).GetInstance(this); } } foreach (DictionaryEntry lDictionaryEntry in lOnTrigger.OutputParameters) { lParameters[i++] = lDictionaryEntry.Value; } ONServiceContext lContext = new ONServiceContext(); lContext.OidAgent = OidAgent; ONServer lComponent = ONContext.GetComponent_Server(lOnTrigger.ClassName, this, lThis); ONContext.InvoqueMethod(lComponent, typeof(ONServiceAttribute), "<Class>" + lOnTrigger.ClassName + "</Class><Service>" + lOnTrigger.ServiceName + "</Service>", lParameters); } catch {} } }
/// <summary> /// Constructor /// </summary> /// <param name="onContext">Context of the execution of the request</param> /// <param name="instance">THIS Instance</param> /// <param name="className">Name of the class that has the services</param> public ONServer(ONServiceContext onContext, ONInstance instance, string className) { ClassName = className; OnContext = onContext; Instance = instance; }
/// <summary> /// Destroy all the resources that are associated with the object /// </summary> public void Dispose() { if (OnContext != null) { OnContext.Dispose(); OnContext = null; } }
/// <summary> /// Default Constructor /// </summary> public ONAction(ONServiceContext onContext, string className) { ClassName = className; OnContext = onContext; }
/// <summary> /// Throws the triggers that has been accepted /// </summary> public void ThrowAcceptedTriggers() { List<ONTrigger> lAcceptedTriggers = AcceptedTriggers; AcceptedTriggers = new List<ONTrigger>(); foreach (ONTrigger lOnTrigger in lAcceptedTriggers) { try { object[] lParameters = new object[lOnTrigger.InputParameters.Count + lOnTrigger.OutputParameters.Count]; int i = 0; ONInstance lThis = null; foreach (DictionaryEntry lDictionaryEntry in lOnTrigger.InputParameters) { lParameters[i++] = lDictionaryEntry.Value; if (string.Compare((lDictionaryEntry.Key as string), lOnTrigger.ArgumentThisName, true) == 0) lThis = (lDictionaryEntry.Value as ONOid).GetInstance(this); } foreach (DictionaryEntry lDictionaryEntry in lOnTrigger.OutputParameters) lParameters[i++] = lDictionaryEntry.Value; ONServiceContext lContext = new ONServiceContext(); lContext.OidAgent = OidAgent; ONServer lComponent = ONContext.GetComponent_Server(lOnTrigger.ClassName, this, lThis); ONContext.InvoqueMethod(lComponent, typeof(ONServiceAttribute), "<Class>" + lOnTrigger.ClassName + "</Class><Service>" + lOnTrigger.ServiceName + "</Service>", lParameters); } catch {} } }