当前位置: 首页>>代码示例>>C#>>正文


C# this.AddScoped方法代码示例

本文整理汇总了C#中this.AddScoped方法的典型用法代码示例。如果您正苦于以下问题:C# this.AddScoped方法的具体用法?C# this.AddScoped怎么用?C# this.AddScoped使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在this的用法示例。


在下文中一共展示了this.AddScoped方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddCqsEngine

        public static IServiceCollection AddCqsEngine(this IServiceCollection services)
        {
            services.AddScoped<IQueryProcessor, QueryProcessor>();
            services.AddScoped<ICommandDispatcher, CommandDispatcher>();

            return services;
        }
开发者ID:Zaid-Al-Omari,项目名称:InetaDatabase,代码行数:7,代码来源:ServiceCollectionExtensions.cs

示例2: ConfigureODataServices

 public static IContainerBuilder ConfigureODataServices(this IContainerBuilder builder)
 {
     builder.AddSingleton<ODataWriterValidator>();
     builder.AddScoped<ODataMessageWriter>();
     builder.AddScoped<ODataRequestContext>();
     return builder;
 }
开发者ID:lewischeng-ms,项目名称:misc,代码行数:7,代码来源:ContainerBuilderExtensions.cs

示例3: AddNotifierEvents

        public static IServiceCollection AddNotifierEvents(this IServiceCollection services)
        {
            services.AddScoped<IEventBus, DefaultOrchardEventBus>();
            services.AddScoped<IEventNotifier, DefaultOrchardEventNotifier>();

            return services;
        }
开发者ID:nicklv,项目名称:Orchard2,代码行数:7,代码来源:ServiceCollectionExtensions.cs

示例4: AddQuotes

        public static void AddQuotes(this IServiceCollection services, DataContextBuilder dataContextBuilder)
        {
            services.AddScoped<IQuoteStore, QuoteStore>();
            services.AddScoped<QuoteManager, QuoteManager>();

            dataContextBuilder.RegisterModel<Quote>();
        }
开发者ID:smeehan82,项目名称:Hermes,代码行数:7,代码来源:ServiceCollectionExtentions.cs

示例5: AddOrchardMvc

        public static IServiceCollection AddOrchardMvc(this IServiceCollection services)
        {
            services
                .AddMvcCore(options =>
                {
                    options.Filters.Add(new ModelBinderAccessorFilter());
                    options.Conventions.Add(new ModuleAreaRouteConstraintConvention());
                    options.ModelBinders.Insert(0, new CheckMarkModelBinder());
                })
                .AddViews()
                .AddViewLocalization()
                .AddRazorViewEngine()
                .AddJsonFormatters();

            services.AddScoped<IModelUpdaterAccessor, LocalModelBinderAccessor>();
            services.AddTransient<IFilterProvider, DependencyFilterProvider>();
            services.AddTransient<IMvcRazorHost, TagHelperMvcRazorHost>();

            services.AddScoped<IAssemblyProvider, OrchardMvcAssemblyProvider>();

            services.AddSingleton<ICompilationService, DefaultRoslynCompilationService>();

            services.Configure<RazorViewEngineOptions>(options =>
            {
                var expander = new ModuleViewLocationExpander();
                options.ViewLocationExpanders.Add(expander);
            });
            return services;
        }
开发者ID:MichaelPetrinolis,项目名称:Orchard2,代码行数:29,代码来源:ServiceCollectionExtensions.cs

示例6: AddSmidge

        public static IServiceCollection AddSmidge(this IServiceCollection services)
        {
            //services.AddNodeServices(NodeHostingModel.Http);

            services.AddTransient<IConfigureOptions<SmidgeOptions>, SmidgeOptionsSetup>();
            services.AddTransient<IConfigureOptions<Bundles>, BundlesSetup>();
            services.AddSingleton<PreProcessPipelineFactory>();
            services.AddSingleton<BundleManager>();
            services.AddSingleton<FileSystemHelper>();
            services.AddSingleton<PreProcessManager>();
            services.AddSingleton<ISmidgeConfig, SmidgeConfig>();
            services.AddScoped<SmidgeContext>();
            services.AddScoped<SmidgeHelper>();
            services.AddSingleton<IUrlManager, DefaultUrlManager>();
            services.AddSingleton<IHasher, Crc32Hasher>();

            //pre-processors
            services.AddSingleton<IPreProcessor, JsMin>();
            services.AddSingleton<IPreProcessor, CssMinifier>();
            //services.AddSingleton<IPreProcessor, NodeMinifier>();
            services.AddScoped<IPreProcessor, CssImportProcessor>();
            services.AddScoped<IPreProcessor, CssUrlProcessor>();


            //Add the controller models as DI services - these get auto created for model binding
            services.AddTransient<BundleModel>();
            services.AddTransient<CompositeFileModel>();

            return services;
        }
开发者ID:eByte23,项目名称:Smidge,代码行数:30,代码来源:SmidgeStartup.cs

示例7: AddOnlineTvDatabase

 public static IServiceCollection AddOnlineTvDatabase(this IServiceCollection services)
 {
     services.AddSingleton<IOnlineTvDatabase, OnlineTvDatabaseClient>();
     services.AddScoped<IHttpClient, HttpClient>();
     services.AddSingleton<IObjectUrlFactory, ObjectUrlFactory>();
     services.AddScoped<IObjectUrlBuilder<GetSeriesInput>, GetSeriesUrlBuilder>();
     return services;
 }
开发者ID:freemsly,项目名称:Online-TV-Database.NET,代码行数:8,代码来源:OnlineTvDatabaseExtensions.cs

示例8: AddDefaultServices

        public static void AddDefaultServices(this IServiceCollection services)
        {
            services.AddMvc();

            services.AddScoped<LogExceptionFilter>();
            services.AddScoped<ExceptionResponseFilter>();
            services.AddScoped<NullFilter>();
        }
开发者ID:MarcusParkkinen,项目名称:artist-lookup-service,代码行数:8,代码来源:ServiceCollectionExtensions.cs

示例9: AddMapProcessing

        public static IServiceCollection AddMapProcessing(
            this IServiceCollection services)
        {
            services.AddScoped<IDungeonPopulator, DungeonPopulator>();
            services.AddScoped<IProcessor, Processor>();

            return services;
        }
开发者ID:CatSkald,项目名称:Roguelike,代码行数:8,代码来源:DependencyInjections.cs

示例10: ConfigureDependencies

 public static IServiceCollection ConfigureDependencies(this IServiceCollection services)
 {
     services.AddScoped<ICarrierRepository, CarrierRepository>();
     services.AddScoped<IDriverRepository, DriverRepository>();
     services.AddScoped<IVehicleRepository, VehicleRepository>();
     services.AddScoped<IRidesRepository, RidesRepository>();
     return services;
 }
开发者ID:SychevIgor,项目名称:conferences,代码行数:8,代码来源:Startup.Dependencies.cs

示例11: AddPages

        public static void AddPages(this IServiceCollection services, DataContextBuilder dataContextBuilder)
        {
            services.AddScoped<IPageStore, PageStore>();
            services.AddScoped<IPageManager, PageManager>();

            dataContextBuilder.RegisterModel<Page>();
            dataContextBuilder.RegisterModel<PlainTextPageContent>();
        }
开发者ID:smeehan82,项目名称:Hermes,代码行数:8,代码来源:ServiceCollectionExtentions.cs

示例12: AddBlogs

        public static void AddBlogs(this IServiceCollection services, DataContextBuilder dataContextBuilder)
        {
            services.AddScoped<IBlogStore, BlogStore>();
            services.AddScoped<IBlogPostStore, BlogPostStore>();
            services.AddScoped<BlogManager, BlogManager>();

            dataContextBuilder.RegisterModel<Blog>();
            dataContextBuilder.RegisterModel<BlogPost>();
        }
开发者ID:smeehan82,项目名称:Hermes,代码行数:9,代码来源:ServiceCollectionExtentions.cs

示例13: AddBackgroundTasks

        public static IServiceCollection AddBackgroundTasks(this IServiceCollection services)
        {
            services.TryAddSingleton<IBackgroundTaskService, BackgroundTaskService>();

            services.AddScoped<BackgroundTasksStarter>();
            services.AddScoped<IOrchardShellEvents>(sp => sp.GetRequiredService<BackgroundTasksStarter>());

            return services;
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:9,代码来源:ServiceCollectionExtensions.cs

示例14: AddCloudscribeSetup

        public static IServiceCollection AddCloudscribeSetup(
            this IServiceCollection services,
            IConfigurationRoot configuration)
        {
            services.Configure<SetupOptions>(configuration.GetSection("SetupOptions"));
            services.AddScoped<SetupManager, SetupManager>();
            services.AddScoped<IVersionProvider, SetupVersionProvider>();

            return services;
        }
开发者ID:joeaudette,项目名称:cloudscribe.Setup,代码行数:10,代码来源:ServiceCollectionExtensions.cs

示例15: AddCommands

        public static IServiceCollection AddCommands(this IServiceCollection services)
        {
            services.AddScoped<ICommandManager, DefaultCommandManager>();
            services.AddScoped<ICommandHandler, HelpCommand>();

            services.AddScoped<ICommandParametersParser, CommandParametersParser>();
            services.AddScoped<ICommandParser, CommandParser>();

            return services;
        }
开发者ID:jchenga,项目名称:Orchard2,代码行数:10,代码来源:ServiceCollectionExtensions.cs


注:本文中的this.AddScoped方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。