本文整理汇总了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;
}
示例2: ConfigureODataServices
public static IContainerBuilder ConfigureODataServices(this IContainerBuilder builder)
{
builder.AddSingleton<ODataWriterValidator>();
builder.AddScoped<ODataMessageWriter>();
builder.AddScoped<ODataRequestContext>();
return builder;
}
示例3: AddNotifierEvents
public static IServiceCollection AddNotifierEvents(this IServiceCollection services)
{
services.AddScoped<IEventBus, DefaultOrchardEventBus>();
services.AddScoped<IEventNotifier, DefaultOrchardEventNotifier>();
return services;
}
示例4: AddQuotes
public static void AddQuotes(this IServiceCollection services, DataContextBuilder dataContextBuilder)
{
services.AddScoped<IQuoteStore, QuoteStore>();
services.AddScoped<QuoteManager, QuoteManager>();
dataContextBuilder.RegisterModel<Quote>();
}
示例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;
}
示例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;
}
示例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;
}
示例8: AddDefaultServices
public static void AddDefaultServices(this IServiceCollection services)
{
services.AddMvc();
services.AddScoped<LogExceptionFilter>();
services.AddScoped<ExceptionResponseFilter>();
services.AddScoped<NullFilter>();
}
示例9: AddMapProcessing
public static IServiceCollection AddMapProcessing(
this IServiceCollection services)
{
services.AddScoped<IDungeonPopulator, DungeonPopulator>();
services.AddScoped<IProcessor, Processor>();
return services;
}
示例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;
}
示例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>();
}
示例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>();
}
示例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;
}
示例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;
}
示例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;
}