/// <summary>
        /// Invokes SftpUploadMiddleware at some point in the pipeline
        /// </summary>
        /// <param name="builder">application builder</param>
        /// <param name="configureOptions">header name options (defaults used, if null)</param>
        /// <returns>a reference to the applicaton builder (for fluent construction)</returns>
        public static IApplicationBuilder UseSftpUpload(
            this IApplicationBuilder builder,
            Action <SftpUploadMiddlewareOptions> configureOptions = null)
        {
            var options = new SftpUploadMiddlewareOptions();

            //configure the options, unless configureOptions is null
            configureOptions?.Invoke(options);

            //use the middleware
            return(builder.UseMiddleware <SftpUploadMiddleware>(options));
        }
示例#2
0
 /// <summary>
 /// Constructs a new SftpUploadMiddleware object
 /// with the required delegate and options
 /// </summary>
 /// <param name="next">delegate used to invoke the next middleware in the pipeline</param>
 /// <param name="options">header names for the connection params</param>
 public SftpUploadMiddleware(
     RequestDelegate next, SftpUploadMiddlewareOptions options) :
     base(next)
 {
     _options = options;
 }