Example #1
0
        private static void Register(IIocService iocService)
        {
            var httpClientFactory = (IHttpClientFactory) new ServiceCollection()
                                    .AddHttpClient()
                                    .BuildServiceProvider()
                                    .GetService(typeof(IHttpClientFactory));

            iocService.RegisterInstance(httpClientFactory);
            iocService.RegisterImplementation <IHttpClientService, Service.HttpClientService>(IocLifetime.Singleton);
            iocService.RegisterImplementation <IHttpClientServiceConfig, DefaultHttpClientServiceConfig>(IocLifetime.Singleton);
            iocService.RegisterConsoleLoggerClientService();
        }
Example #2
0
        public static IIocService RegisterXamarinAnalyticsService <TConfig>(this IIocService iocService)
            where TConfig : class, IApplicationInsightsConfig
        {
            iocService.RegisterConsoleLoggerClientService();

            iocService.RegisterImplementation <IApplicationInsightsConfig, TConfig>(IocLifetime.Singleton);
            iocService.RegisterImplementation <ITelemetryClientProxy, TelemetryClientProxy>(IocLifetime.Singleton);
            iocService.RegisterImplementation <ITelemetryDecorator, TelemetryDecorator>();

            iocService.RegisterImplementation <IAnalyticsSessionFactory, XamarinSessionFactory>(IocLifetime.Singleton);
            iocService.RegisterImplementation <IAnalyticsService, AnalyticsService>(IocLifetime.Singleton);

            return(iocService);
        }