Example #1
0
        public static IApplicationBuilder UserDbRESTFul(this IApplicationBuilder app,
                                                        IApiAuthorizeFilter authorizeFilter,
                                                        bool apiOnly = false,
                                                        IResponseResultResolver responseResultResolver = null)
        {
            var loggerFactory = app.ApplicationServices.GetRequiredService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger("DbRESTFulAPI");

            LoggerManager.Use(logger);

            var apiFilter = new ConfiguredApiFilter()
            {
                ApiAuthorizeFilter = authorizeFilter
            };

            CacheProviderFactory.Init();

            apiFilter.ResponseResultResolver = responseResultResolver == null
                ? new DefaultResponseResultResolver()
                : responseResultResolver;

            app.UseMiddleware <DbRESTFulApiMiddleware>(apiFilter, apiOnly);

            return(app);
        }
Example #2
0
        public static IApplicationBuilder UseMicroServiceContainer(this IApplicationBuilder app, IConfigurationRoot configuration,
                                                                   IApiAuthorizeFilter authorizeFilter)
        {
            var loggerFactory = app.ApplicationServices.GetRequiredService <ILoggerFactory>();
            var logger        = loggerFactory.CreateLogger("DbRESTFulAPI");

            app.UseServiceContainer(configuration, loggerFactory);

            LoggerManager.Use(logger);
            var apiFilter = new ConfiguredApiFilter
            {
                ApiAuthorizeFilter     = authorizeFilter,
                ResponseResultResolver = new DefaultResponseResultResolver()
            };

            app.UseMiddleware <DbRESTFulServiceMiddleware>(apiFilter);

            return(app);
        }