コード例 #1
0
ファイル: Loxy.cs プロジェクト: Agnael/Sero.Loxy
        public Loxy(IHttpContextAccessor httpContext,
                    IAppInfoService appInfoService,
                    IRequestInfoService reqInfoService,
                    LoxyBuilder loxyBuilder)
        {
            if (httpContext == null)
            {
                throw new ArgumentNullException(nameof(httpContext));
            }
            if (appInfoService == null)
            {
                throw new ArgumentNullException(nameof(appInfoService));
            }
            if (reqInfoService == null)
            {
                throw new ArgumentNullException(nameof(reqInfoService));
            }
            if (loxyBuilder == null)
            {
                throw new ArgumentNullException(nameof(loxyBuilder));
            }

            EventHistory           = new List <IEvent>();
            HttpContext            = httpContext.HttpContext;
            ApplicationInfoService = appInfoService;
            RequestInfoService     = reqInfoService;
            Sinks = loxyBuilder.Sinks.Sinks;
        }
コード例 #2
0
ファイル: SinkManager.cs プロジェクト: Agnael/Sero.Loxy
        public SinkManager(LoxyBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            CurrentLoxyBuilder = builder;
            Sinks = new List <ISink>();
        }
コード例 #3
0
        public static LoxyBuilder AddLoxy(this IServiceCollection services)
        {
            services.AddAppInfo();
            services.AddRequestInfo();

            var builder = new LoxyBuilder(services);

            services.TryAddScoped <LoxyMiddleware>();

            services.TryAddScoped <ILoxy>(serviceProvider =>
            {
                var httpContextAccessor = serviceProvider.GetService <IHttpContextAccessor>();
                var appInfoService      = serviceProvider.GetService <IAppInfoService>();
                var requestInfoService  = serviceProvider.GetService <IRequestInfoService>();

                Loxy instance = new Loxy(httpContextAccessor, appInfoService, requestInfoService, builder);
                return(instance);
            });

            return(builder);
        }