Example #1
0
        public static IImageSourceServiceCollection AddService <TImageSource>(this IImageSourceServiceCollection services, Func <IServiceProvider, IImageSourceService <TImageSource> > implementationFactory)
            where TImageSource : IImageSource
        {
            services.AddSingleton(provider => implementationFactory(((IImageSourceServiceProvider)provider).HostServiceProvider));

            return(services);
        }
Example #2
0
        public static IImageSourceServiceCollection AddService <TImageSource, [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] TImageSourceService>(this IImageSourceServiceCollection services)
            where TImageSource : IImageSource
            where TImageSourceService : class, IImageSourceService <TImageSource>
        {
            services.AddSingleton <IImageSourceService <TImageSource>, TImageSourceService>();

            return(services);
        }
Example #3
0
        public static IImageSourceServiceCollection AddService <TImageSource, TImageSourceService>(this IImageSourceServiceCollection services)
            where TImageSource : IImageSource
            where TImageSourceService : class, IImageSourceService <TImageSource>
        {
            services.AddSingleton <IImageSourceService <TImageSource>, TImageSourceService>();

            return(services);
        }