internal void Initialize(HandleInitializationContext context)
        {
            this.owner           = context.OwningActivityInstance;
            this.isUninitialized = false;

            OnInitialize(context);
        }
        internal override bool TryPopulateLocation(ActivityExecutor executor, ActivityContext activityContext)
        {
            T    local;
            bool flag = true;
            VariableLocation <T> location = new VariableLocation <T>(base.Modifiers, base.IsHandle);

            if (base.IsHandle)
            {
                activityContext.Environment.DeclareHandle(this, location, activityContext.CurrentInstance);
                using (HandleInitializationContext context = new HandleInitializationContext(executor, activityContext.CurrentInstance))
                {
                    location.SetInitialValue((T)context.CreateAndInitializeHandle(typeof(T)));
                    return(flag);
                }
            }
            activityContext.Environment.Declare(this, location, activityContext.CurrentInstance);
            if (this.Default == null)
            {
                return(flag);
            }
            if (this.Default.TryGetValue(activityContext, out local))
            {
                location.SetInitialValue(local);
                return(flag);
            }
            location.SetIsWaitingOnDefaultValue();
            return(false);
        }
Esempio n. 3
0
 protected override void OnUninitialize(HandleInitializationContext context)
 {
     if (this.rootTransaction != null)
     {
         this.executor.ExitNoPersist();
     }
     this.isHandleInitialized = false;
     base.OnUninitialize(context);
 }
Esempio n. 4
0
 protected override void OnInitialize(HandleInitializationContext context)
 {
     this.executor            = context.Executor;
     this.isHandleInitialized = true;
     if (this.rootTransaction != null)
     {
         this.executor.SetTransaction(this, this.rootTransaction, null, null);
     }
     base.OnInitialize(context);
 }
Esempio n. 5
0
        protected override void OnUninitialize(HandleInitializationContext context)
        {
            if (this.rootTransaction != null)
            {
                // If we have a host transaction we're responsible for exiting no persist
                this.executor.ExitNoPersist();
            }

            this.isHandleInitialized = false;
            base.OnUninitialize(context);
        }
Esempio n. 6
0
        protected override void OnInitialize(HandleInitializationContext context)
        {
            this.executor            = context.Executor;
            this.isHandleInitialized = true;

            if (this.rootTransaction != null)
            {
                Fx.Assert(this.Owner == null, "this.rootTransaction should only be set at the root");
                this.executor.SetTransaction(this, this.rootTransaction, null, null);
            }

            base.OnInitialize(context);
        }
Esempio n. 7
0
 protected override void OnUninitialize(HandleInitializationContext context)
 {
     if (this.bookmarkScope != null)
     {
         int scopeRefCount = this.bookmarkScope.DecrementHandleReferenceCount();
         DisassociateInstanceKeysExtension extension = context.GetExtension <DisassociateInstanceKeysExtension>();
         // We only unregister the BookmarkScope if the extension exists and is enabled and if we had the last reference to it.
         if ((extension != null) && extension.AutomaticDisassociationEnabled && (scopeRefCount == 0))
         {
             context.UnregisterBookmarkScope(this.bookmarkScope);
         }
     }
     base.OnUninitialize(context);
 }
Esempio n. 8
0
 protected override void OnInitialize(HandleInitializationContext context)
 {
     throw new NotImplementedException();
 }
Esempio n. 9
0
 protected override void OnInitialize(HandleInitializationContext context)
 {
     this.owningInstance = context.OwningActivityInstance;
     this.executor       = context.Executor;
     PerformDefaultRegistration();
 }
Esempio n. 10
0
 protected virtual void OnUninitialize(HandleInitializationContext context)
 {
     throw new NotImplementedException();
 }
Esempio n. 11
0
 protected virtual void OnUninitialize(HandleInitializationContext context)
 {
 }
Esempio n. 12
0
 internal void Uninitialize(HandleInitializationContext context)
 {
     OnUninitialize(context);
     this.isUninitialized = true;
 }