Ejemplo n.º 1
0
        public static IDetectionBuilder AddRequiredPlatformServices(this IDetectionBuilder builder)
        {
            // Hosting doesn't add IHttpContextAccessor by default
            builder.Services.AddHttpContextAccessor();

            // Add Detection Options
            builder.Services.AddOptions();
            builder.Services.TryAddSingleton(
                provider => provider.GetRequiredService <IOptions <DetectionOptions> >().Value);

            return(builder);
        }
        public static IDetectionBuilder AddCoreServices(this IDetectionBuilder builder)
        {
            // Add Basic core to services
            builder.Services.TryAddScoped <IUserAgentService, UserAgentService>();
            builder.Services.TryAddScoped <IDeviceService, DeviceService>();
            builder.Services.TryAddScoped <IEngineService, EngineService>();
            builder.Services.TryAddScoped <IPlatformService, PlatformService>();
            builder.Services.TryAddScoped <IBrowserService, BrowserService>();
            builder.Services.TryAddScoped <ICrawlerService, CrawlerService>();
            builder.Services.TryAddScoped <IDetectionService, DetectionService>();

            return(builder);
        }
Ejemplo n.º 3
0
        public static IDetectionBuilder AddResponsiveService(this IDetectionBuilder builder)
        {
            if (builder is null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            builder.Services.TryAddTransient <IResponsiveService, ResponsiveService>();
            builder.Services.AddRazorViewLocation();
            builder.Services.AddRazorPagesConventions();

            return(builder);
        }
Ejemplo n.º 4
0
        public static IDetectionBuilder AddSessionServices(this IDetectionBuilder builder)
        {
            // Add Session to services
            builder.Services.AddDistributedMemoryCache();
            builder.Services.AddSession(
                options =>
            {
                options.Cookie.Name        = "Detection";
                options.IdleTimeout        = TimeSpan.FromSeconds(10);
                options.Cookie.IsEssential = true;
            });

            return(builder);
        }
        public static IDetectionBuilder AddMarkerService(this IDetectionBuilder builder)
        {
            builder.Services.TryAddSingleton <DetectionMarkerService, DetectionMarkerService>();

            return(builder);
        }
        public static IDetectionBuilder AddDevice(this IDetectionBuilder builder)
        {
            builder.Services.AddTransient <IDeviceResolver, DeviceResolver>();

            return(builder);
        }
Ejemplo n.º 7
0
        // concept idea on adding platform detection to client service
        public static IDetectionBuilder AddBrowser(this IDetectionBuilder builder)
        {
            builder.Services.AddTransient <IBrowserResolver, BrowserResolver>();

            return(builder);
        }
        // Concept idea on adding engine detection to client service
        public static IDetectionBuilder AddEngine(this IDetectionBuilder builder)
        {
            builder.Services.TryAddTransient <IEngineResolver, EngineResolver>();

            return(builder);
        }
        // Concept idea on adding platform detection to client service
        public static IDetectionBuilder AddPlatform(this IDetectionBuilder builder)
        {
            builder.Services.AddTransient <IPlatformResolver, PlatformResolver>();

            return(builder);
        }