Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        public SinkManager(LoxyBuilder builder)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            CurrentLoxyBuilder = builder;
            Sinks = new List <ISink>();
        }
Ejemplo n.º 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);
        }