예제 #1
0
        /// <summary>
        /// Initializes this binding configuration element with the content of the specified binding.
        /// </summary>
        /// <param name="binding">A binding.</param>
        /// <exception cref="T:System.ArgumentNullException">
        ///     <paramref name="binding"/> is null.</exception>
        /// <exception cref="T:System.ArgumentException">The type of this binding element is different from the type specified by <paramref name="binding"/>.</exception>
        protected override void InitializeFrom(Binding binding)
        {
            base.InitializeFrom(binding);
            NmsBinding nmsBinding = (NmsBinding)binding;

            Destination     = nmsBinding.Destination;
            DestinationType = nmsBinding.DestinationType;
        }
예제 #2
0
        /// <summary>
        /// Called when the content of a specified binding element is applied to this binding configuration element.
        /// </summary>
        /// <param name="binding">A binding.</param>
        protected override void OnApplyConfiguration(Binding binding)
        {
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }

            if (binding.GetType() != typeof(NmsBinding))
            {
                throw new ArgumentException(String.Format(CultureInfo.CurrentCulture, "Invalid type for binding. Expected tpye: {0}. Type passed in: {1}.", typeof(NmsBinding).AssemblyQualifiedName, binding.GetType().AssemblyQualifiedName));
            }

            NmsBinding nmsBinding = (NmsBinding)binding;

            nmsBinding.Destination     = Destination;
            nmsBinding.DestinationType = DestinationType;
        }