예제 #1
0
        public static IObservable <BaseNotification> UseNotification(this IApplicationBuilder app,
                                                                     NotificationChannelMiddlewareOptions options)
        {
            if (string.IsNullOrWhiteSpace(options.AuthorizationPolicyName))
            {
                throw new ArgumentException("The value of the AuthorizationPolicyName property is invalid.", nameof(options));
            }

            if (string.IsNullOrWhiteSpace(options.UrlPrefix))
            {
                throw new ArgumentException("The value of the UrlPrefix property is invalid.", nameof(options));
            }

            var mw = new NotificationChannelMiddleware(options);

            app.Use((next) => {
                mw.Delegate = next;
                return(mw.Invoke);
            });

            return(mw.Observable);
        }
예제 #2
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="options">options to configure this middleware</param>
 public NotificationChannelMiddleware(NotificationChannelMiddlewareOptions options)
 {
     _options = options;
 }