Пример #1
0
        public static PluggableModuleBuilder AddService <TService, TImplementation>(
            [NotNull] this PluggableModuleBuilder builder)
            where TService : class
            where TImplementation : class, TService
        {
            Requires.NotNull(builder, nameof(builder));

            return(builder.AddService <TService, TImplementation, Enum>(null));
        }
Пример #2
0
        public static PluggableModuleBuilder AddService <TService, TImplementation, TOperations>(
            [NotNull] this PluggableModuleBuilder builder,
            TOperations unsupportedOperations)
            where TService : class
            where TImplementation : class, TService
            where TOperations : Enum
        {
            Requires.NotNull(builder, nameof(builder));

            TOperations supportedOperations = ConvertToSupportedOperations(unsupportedOperations);

            builder.Module.Register <TService, TImplementation>(supportedOperations);

            builder.Services.AddTransient <TImplementation>();

            return(builder);
        }