예제 #1
0
        public static IApplicationBuilder UseDevReload(this IApplicationBuilder app, DevReloadOptions options)
        {
            if (app == null)
            {
                throw new ArgumentNullException(nameof(app));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            return(app.UseMiddleware <DevReloadMiddleware>(Options.Create(options)));
        }
        public DevReloadMiddleware(
            RequestDelegate next,
            IOptions <DevReloadOptions> options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            _time    = System.DateTime.Now.ToString();
            _watcher = new FileSystemWatcher();
            _next    = next ?? throw new ArgumentNullException(nameof(next));
            _options = options.Value;

            Task.Run(Watch);
        }