示例#1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="serviceProvider"></param>
 public DefaultSubmitHandler(IServiceProvider serviceProvider)
 {
     //RWM: This stuff SHOULD be getting passed into a constructor. But the DI implementation is less than awesome.
     //     So we'll work around it for now and still save some allocations.
     initializer = serviceProvider.GetService <IChangeSetInitializer>();
     executor    = serviceProvider.GetService <ISubmitExecutor>();
     authorizer  = serviceProvider.GetService <IChangeSetItemAuthorizer>();
     validator   = serviceProvider.GetService <IChangeSetItemValidator>();
     filter      = serviceProvider.GetService <IChangeSetItemFilter>();
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="DefaultSubmitHandler"/> class.
        /// </summary>
        /// <param name="initializer">A reference to a service that can initialize a change set.</param>
        /// <param name="executor">A reference to a service that executes a submission.</param>
        /// <param name="authorizer">An optional reference to an service that authorizes a submission.</param>
        /// <param name="validator">An optional reference to a service that validates a submission.</param>
        /// <param name="filter">An optional reference to a service that executes logic before and after a submission.</param>
        public DefaultSubmitHandler(IChangeSetInitializer initializer, ISubmitExecutor executor,
                                    IChangeSetItemAuthorizer authorizer = null, IChangeSetItemValidator validator = null,
                                    IChangeSetItemFilter filter         = null)
        {
            Ensure.NotNull(initializer, nameof(initializer));
            Ensure.NotNull(executor, nameof(executor));

            this.initializer = initializer;
            this.authorizer  = authorizer;
            this.validator   = validator;
            this.filter      = filter;
            this.executor    = executor;
        }