示例#1
0
        /// <summary>
        /// Creates a new <see cref="T:System.Data.Entity.Infrastructure.Interception.BeginTransactionInterceptionContext" /> that contains all the contextual information in this
        /// interception context together with the given property value.
        /// </summary>
        /// <param name="value">The value that will be assigned to the target property.</param>
        /// <returns>A new interception context associated with the given property value.</returns>
        public PropertyInterceptionContext <TValue> WithValue(TValue value)
        {
            PropertyInterceptionContext <TValue> interceptionContext = this.TypedClone();

            interceptionContext._value = value;
            return(interceptionContext);
        }
示例#2
0
        /// <summary>
        /// Creates a new <see cref="T:System.Data.Entity.Infrastructure.Interception.PropertyInterceptionContext`1" /> by copying immutable state from the given
        /// interception context. Also see <see cref="M:System.Data.Entity.Infrastructure.Interception.PropertyInterceptionContext`1.Clone" />
        /// </summary>
        /// <param name="copyFrom">The context from which to copy state.</param>
        public PropertyInterceptionContext(DbInterceptionContext copyFrom)
            : base(copyFrom)
        {
            Check.NotNull <DbInterceptionContext>(copyFrom, nameof(copyFrom));
            PropertyInterceptionContext <TValue> interceptionContext = copyFrom as PropertyInterceptionContext <TValue>;

            if (interceptionContext == null)
            {
                return;
            }
            this._value = interceptionContext._value;
        }