public void DisablePrototype(Int32 compositeMethodIndex, MethodGenericArgumentsInfo gArgsInfo, AbstractFragmentMethodModel nextMethod) { ApplicationSkeleton.ThreadsafeStateTransition(ref this._isPrototype, (Int32)PrototypeState.PROTOTYPE, (Int32)PrototypeState.IN_TRANSITION_RUNNING_ACTION, (Int32)PrototypeState.NOT_PROTOTYPE, true, ref this._isPrototypeTransitionInProgress, ApplicationSkeleton.WAIT_TIME, () => { this.RunPrototypeAction(compositeMethodIndex, gArgsInfo, nextMethod); Interlocked.Exchange(ref this._isPrototype, (Int32)PrototypeState.IN_TRANSITION_CHECKING_STATE); this.CheckCompositeState(compositeMethodIndex, gArgsInfo, nextMethod); ((CompositeModelImmutable)this.ModelInfo.Model).InvokeCompositeInstantiated(this); }); }
protected MethodInfo GetCompositeMethodInfo(Int32 compositeMethodIndex, MethodGenericArgumentsInfo gArgsInfo) { var retVal = compositeMethodIndex >= 0 ? this._compositeMethods.Value[compositeMethodIndex] : null; if (retVal != null && gArgsInfo != null) { retVal = retVal.MakeGenericMethod(gArgsInfo.GetGenericArguments()); } return(retVal); }
private void CheckCompositeState(Int32 compositeMethodIndex, MethodGenericArgumentsInfo gArgsInfo, AbstractFragmentMethodModel nextMethod) { if (this._checkStateFunc != null) { var violations = new Dictionary <QualifiedName, IList <ConstraintViolationInfo> >(); this._checkStateFunc(violations); if (violations.Any()) { throw new CompositeInstantiationException(violations); } } }
public void ActivateIfNeeded(Int32 compositeMethodIndex, MethodGenericArgumentsInfo gArgsInfo, AbstractFragmentMethodModel nextFragment) { if ((Int32)ActivatingAllowed.ALLOWED == this._activatingAllowed) { ApplicationSkeleton.PerformActivation(ref this._activationState, ref this._activationInProgress, this._passivationInProgress, ApplicationSkeleton.WAIT_TIME, false, () => { CompositePropertySPI idProp = (CompositePropertySPI)this.State.Properties[IDENTITY_QNAME]; if (Convert.ToBoolean(this._needToSetIdentity)) { idProp.PropertyValueAsObject = this._serviceID; Interlocked.Exchange(ref this._needToSetIdentity, Convert.ToInt32(false)); } // Disable prototype this.DisablePrototype(compositeMethodIndex, gArgsInfo, nextFragment); if (this._activationAction != null) { var compositeMethod = this.GetCompositeMethodInfo(compositeMethodIndex, gArgsInfo); if (compositeMethod != null) { this.InvocationInfo = new InvocationInfoImpl(compositeMethod, nextFragment); } try { this._activationAction(); } finally { if (compositeMethod != null) { this.InvocationInfo = null; } } } ((ServiceCompositeModelImmutable)this.ModelInfo.Model).InvokeAfterActivation(this); }); } }
private void RunPrototypeAction(Int32 compositeMethodIndex, MethodGenericArgumentsInfo gArgsInfo, AbstractFragmentMethodModel nextMethod) { if (this._prototypeAction != null) { var compositeMethod = this.GetCompositeMethodInfo(compositeMethodIndex, gArgsInfo); if (compositeMethod != null) { this._invocationInfos.Value.Value.Push(new InvocationInfoImpl(compositeMethod, nextMethod)); } try { this._prototypeAction(); } finally { if (compositeMethod != null) { this._invocationInfos.Value.Value.Pop(); } } } }