public DurableInstanceContextBindingElement(BindingElement other)
            : base(other)
        {
            DurableInstanceContextBindingElement otherBindingElement = other as DurableInstanceContextBindingElement;

            if (otherBindingElement != null)
            {
                this.contextStoreLocation = otherBindingElement.contextStoreLocation;
                this.contextType          = otherBindingElement.contextType;

                if ((contextStoreLocation == null) ||
                    (contextStoreLocation.Trim().Length == 0))
                {
                    InitializeContextStoreLocation();
                }
                else
                {
                    // Throw if the specified contextStoreLocation is
                    // invalid.
                    if (!Directory.Exists(contextStoreLocation))
                    {
                        throw new InvalidOperationException(
                                  ResourceHelper.GetString(@"ExInvalidContextStorePath"));
                    }
                }
            }
            else
            {
                this.contextType = ContextType.MessageHeader;
                InitializeContextStoreLocation();
            }
        }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);

            DurableInstanceContextBindingElement typedBindingElement =
                (DurableInstanceContextBindingElement)bindingElement;

            this.contextStoreLocation = typedBindingElement.ContextStoreLocation;
            this.contextType          = typedBindingElement.ContextType;
        }
        protected override BindingElement CreateBindingElement()
        {
            DurableInstanceContextBindingElement bindingElement =
                new DurableInstanceContextBindingElement();

            bindingElement.ContextStoreLocation =
                this.contextStoreLocation;

            bindingElement.ContextType = this.contextType;
            ApplyConfiguration(bindingElement);
            return(bindingElement);
        }