Esempio n. 1
0
        public static PlatformBuilder ConfigureWebApi(this PlatformBuilder builder, Action <PlatformexWebApiOptions> optionsBuilder)
        {
            var options = new PlatformexWebApiOptions("api");

            optionsBuilder(options);
            builder.AddConfigureServicesActions(collection =>
            {
                collection.AddSingleton(options);
            });
            return(builder);
        }
        public PlatformexMiddleware(
            RequestDelegate next,
            PlatformexWebApiOptions options,
            IPlatform platform,
            ILogger <PlatformexMiddleware> log)
        {
            _next     = next;
            _platform = platform;
            _log      = log;

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

            _commandPath = new Regex(basePath + "/(?<context>[a-z]+)/(?<name>[a-z]+)/{0,1}",
                                     RegexOptions.IgnoreCase | RegexOptions.Compiled);
            _queryPath = new Regex(basePath + "/queries/(?<name>[a-z0-9]+)/{0,1}",
                                   RegexOptions.IgnoreCase | RegexOptions.Compiled);
        }