コード例 #1
0
        public static EventFlyWebApiBuilder ConfigureWebApi(this EventFlyBuilder eventFlyBuilder, Action <EventFlyWebApiOptions> optionsBuilder)
        {
            var options = new EventFlyWebApiOptions("api");

            optionsBuilder(options);
            eventFlyBuilder.Services.AddSingleton(options);
            return(new EventFlyWebApiBuilder(eventFlyBuilder));
        }
コード例 #2
0
        public EventFlyMiddleware(
            RequestDelegate next,
            ILogger <EventFlyMiddleware> log,
            EventFlyWebApiOptions options,
            ISerializedCommandPublisher serializedCommandPublisher,
            ISerializedQueryExecutor serializedQueryExecutor)
        {
            _next = next;
            _log  = log;
            _serializedCommandPublisher = serializedCommandPublisher;
            _serializedQueryExecutor    = serializedQueryExecutor;

            var basePath = "/*" + options.BasePath.Trim('/');

            CommandPath = new Regex(basePath + "/(?<name>[a-z]+)/(?<version>\\d+)/{0,1}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
            QueryPath   = new Regex(basePath + "/(?<name>[a-z0-9]+)/{0,1}", RegexOptions.IgnoreCase | RegexOptions.Compiled);
        }