예제 #1
0
        /// <summary>
        /// Adds the specified command interceptor implementation to the manager,
        /// with the specified explicit metadata.
        /// </summary>
        /// <param name="interceptor">The command interceptor instance, which does not need to
        /// be annotated with the <see cref="CommandInterceptorAttribute"/> attribute since
        /// it's provided explicitly.</param>
        /// <param name="metadata">Explicit metadata to use for the command interceptor,
        /// instead of reflecting the <see cref="CommandInterceptorAttribute"/>.</param>
        public void AddInterceptor(ICommandInterceptor interceptor, CommandInterceptorAttribute metadata)
        {
            Guard.NotNull(() => interceptor, interceptor);
            Guard.NotNull(() => metadata, metadata);

            var commandInterceptors = this.registeredInterceptors.GetOrAdd(
                Tuple.Create(new Guid(metadata.GroupId), metadata.CommandId),
                key => new List <ICommandInterceptor>());

            commandInterceptors.Add(interceptor);
        }
예제 #2
0
        /// <summary>
        /// Adds the specified command interceptor implementation to the manager,
        /// with the specified explicit metadata.
        /// </summary>
        /// <param name="interceptor">The command interceptor instance, which does not need to
        /// be annotated with the <see cref="CommandInterceptorAttribute"/> attribute since
        /// it's provided explicitly.</param>
        /// <param name="metadata">Explicit metadata to use for the command interceptor,
        /// instead of reflecting the <see cref="CommandInterceptorAttribute"/>.</param>
        public void AddInterceptor(ICommandInterceptor interceptor, CommandInterceptorAttribute metadata)
        {
            Guard.NotNull(() => interceptor, interceptor);
            Guard.NotNull(() => metadata, metadata);

            var commandInterceptors = this.registeredInterceptors.GetOrAdd(
                Tuple.Create(new Guid(metadata.GroupId), metadata.CommandId),
                key => new List<ICommandInterceptor>());

            commandInterceptors.Add(interceptor);
        }