本文整理汇总了C#中ConfigurationExpression.For方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationExpression.For方法的具体用法?C# ConfigurationExpression.For怎么用?C# ConfigurationExpression.For使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigurationExpression
的用法示例。
在下文中一共展示了ConfigurationExpression.For方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(ConfigurationExpression cfg, IFoundationConfigurator foundationConfigurator)
{
if (foundationConfigurator.UseQueryContainer)
{
cfg.AddRegistry(new QueryRegistery());
cfg.For<IQueryRegistery>().Use<QueryRegistery>();
}
if (foundationConfigurator.UseBuseinssManagers)
{
cfg.AddRegistry(new BusinessManagerRegistery());
cfg.For<IBusinessManagerRegistery>().Use<BusinessManagerRegistery>();
cfg.For<IBusinessManagerInvocationLogger>(foundationConfigurator.Business.BusinessInvocationLogger, true);
}
if (foundationConfigurator.UseEmailing)
{
cfg.AddRegistry(new EmailRegistery());
cfg.For<IEmailLogger>(foundationConfigurator.Business.EmailLogger);
}
if (foundationConfigurator.Web.FlashMessenger != null)
{
cfg.For<IFlashMessenger>(foundationConfigurator.Web.FlashMessenger);
}
cfg.AddRegistry(new SecurityRegistery());
}
示例2: ConfigureHttpInterfaces
private void ConfigureHttpInterfaces(ConfigurationExpression x)
{
// Woot!! Interfaces for HttpContext stuff! Goodbye to nasty unmockable
// abstract base classes.
// http://haacked.com/archive/2007/09/09/ihttpcontext-and-other-interfaces-for-your-duck-typing-benefit.aspx
// Update: the third party library in that post causes problems in production if multiple
// requests during the bootstrapping process. I made hand-rolled proxies instead, which you can get here:
// http://github.com/jonkruger/httpinterfaces
x.For<IHttpApplication>().Use(
c => WebContext.Cast(HttpContext.Current.ApplicationInstance));
x.For<IHttpApplicationState>().Use(
c => WebContext.Cast(HttpContext.Current.Application));
x.For<IHttpCachePolicy>().Use(
c => WebContext.Cast(HttpContext.Current.Response.Cache));
x.For<IHttpClientCertificate>().Use(
c => WebContext.Cast(HttpContext.Current.Request.ClientCertificate));
x.For<IHttpContext>().Use(
c => WebContext.Cast(HttpContext.Current));
x.For<IHttpFileCollection>().Use(
c => WebContext.Cast(HttpContext.Current.Request.Files));
x.For<IHttpModuleCollection>().Use(
c => WebContext.Cast(HttpContext.Current.ApplicationInstance.Modules));
x.For<IHttpRequest>().Use(
c => WebContext.Cast(HttpContext.Current.Request));
x.For<IHttpResponse>().Use(
c => WebContext.Cast(HttpContext.Current.Response));
x.For<IHttpServerUtility>().Use(
c => WebContext.Cast(HttpContext.Current.Server));
x.For<IHttpSession>().Use(
c => WebContext.Cast(HttpContext.Current.Session));
x.For<ITraceContext>().Use(
c => WebContext.Cast(HttpContext.Current.Trace));
}
示例3: InitializeActivityLogging
protected virtual void InitializeActivityLogging(ConfigurationExpression x)
{
x.For<IActivityLogPathProvider>().HybridHttpOrThreadLocalScoped().Use<ActivityLogPathProvider>();
x.For<ILogManager>().HybridHttpOrThreadLocalScoped().Use<TpLogManager>();
x.For<Log4NetFileRepositoryMock>().Singleton().Use<Log4NetFileRepositoryMock>();
x.Forward<Log4NetFileRepositoryMock, ILog4NetFileRepository>();
}
示例4: AddGitChangeTypes
public static void AddGitChangeTypes(ConfigurationExpression initializer)
{
initializer.For<IGitChangedFile>().Use<Add>().Named("A");
initializer.For<IGitChangedFile>().Use<Modify>().Named("M");
initializer.For<IGitChangedFile>().Use<Delete>().Named("D");
initializer.For<IGitChangedFile>().Use<RenameEdit>().Named("R");
}
示例5: ConfigureContainer
private static void ConfigureContainer(ConfigurationExpression container)
{
//Swap out the default ContentRenderer for our custom
container.For<IContentRenderer>().Use<ErrorHandlingContentRenderer>();
container.For<ContentAreaRenderer>().Use<AlloyContentAreaRenderer>();
//Implementations for custom interfaces can be registered here.
}
示例6: ConfigureContainer
private static void ConfigureContainer(ConfigurationExpression container)
{
//Swap out the default ContentRenderer for our custom
//container.For<IContentRenderer>().Use<ErrorHandlingContentRenderer>();
container.For<ContentAreaRenderer>().Use<ContentAreaWithDefaultsRenderer>();
container.For<ICustomerAddressRepository>().Use<CustomerAddressRepository>();
container.For<IOrderRepository>().Use<OrderRepository>();
container.For<IExportOrderService>().Use<ExportOrderService>();
}
示例7: Initialize
private static void Initialize(ConfigurationExpression initializer)
{
var tfsPlugin = TfsPlugin.Find();
initializer.Scan(x => { Initialize(x); tfsPlugin.Initialize(x); });
initializer.For<TextWriter>().Use(() => Console.Out);
initializer.For<IGitRepository>().Add<GitRepository>();
AddGitChangeTypes(initializer);
DoCustomConfiguration(initializer);
tfsPlugin.Initialize(initializer);
}
示例8: ConfigureContainer
private static void ConfigureContainer(ConfigurationExpression container)
{
container.For<IEpiServerDependenciesResolver>().Use<EpiServerDependenciesResolver>();
container.For<IBlockHelper>().Use<BlockHelper>();
container.For<IContextResolver>().Use<ContextResolver>();
container.For<ILinkResolver>().Use<LinkResolver>()
.Ctor<IEpiServerDependenciesResolver>().Is<EpiServerDependenciesResolver>();
container.For<IEpiServerDependencies>()
.Use<EpiServerDependencies>();
}
开发者ID:jondjones,项目名称:JonDJones.com.EpiServerContentMigrationWithJson,代码行数:11,代码来源:StructureMapSetUp.cs
示例9: SetupContainer
private static void SetupContainer(ConfigurationExpression x)
{
x.For<IHttpSession>().Use<CurrentHttpContextSession>();
x.Scan(i =>
{
i.TheCallingAssembly();
i.Convention<SettingsScanner>();
});
x.For<ISettingsProvider>().Use<AppSettingsProvider>();
x.SetAllProperties(s => s.Matching(p => p.Name.EndsWith("Settings")));
}
示例10: Configure
static void Configure(ConfigurationExpression x)
{
x.AddRegistry(new MyAppRegistry());
x.For<IObjectContainer>()
.Singleton()
.Use(Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), DbPath));
x.For(typeof (IRepository<>))
.Use(typeof (Repository<>));
}
示例11: AddGitChangeTypes
public static void AddGitChangeTypes(ConfigurationExpression initializer)
{
// See git-diff-tree(1).
initializer.For<IGitChangedFile>().Use<Add>().Named(GitChangeInfo.ChangeType.ADD);
initializer.For<IGitChangedFile>().Use<Copy>().Named(GitChangeInfo.ChangeType.COPY);
initializer.For<IGitChangedFile>().Use<Modify>().Named(GitChangeInfo.ChangeType.MODIFY);
//initializer.For<IGitChangedFile>().Use<TypeChange>().Named(GitChangeInfo.GitChange.TYPECHANGE);
initializer.For<IGitChangedFile>().Use<Delete>().Named(GitChangeInfo.ChangeType.DELETE);
initializer.For<IGitChangedFile>().Use<RenameEdit>().Named(GitChangeInfo.ChangeType.RENAMEEDIT);
//initializer.For<IGitChangedFile>().Use<Unmerged>().Named(GitChangeInfo.GitChange.UNMERGED);
//initializer.For<IGitChangedFile>().Use<Unknown>().Named(GitChangeInfo.GitChange.UNKNOWN);
}
示例12: AddGitChangeTypes
public static void AddGitChangeTypes(ConfigurationExpression initializer)
{
// See git-diff-tree(1).
initializer.For<IGitChangedFile>().Use<Add>().Named("A");
initializer.For<IGitChangedFile>().Use<Copy>().Named("C");
initializer.For<IGitChangedFile>().Use<Modify>().Named("M");
//initializer.For<IGitChangedFile>().Use<TypeChange>().Named("T");
initializer.For<IGitChangedFile>().Use<Delete>().Named("D");
initializer.For<IGitChangedFile>().Use<RenameEdit>().Named("R");
//initializer.For<IGitChangedFile>().Use<Unmerged>().Named("U");
//initializer.For<IGitChangedFile>().Use<Unknown>().Named("X");
}
示例13: ConfigureInjections
/// <summary>
/// Configures all injections.
/// </summary>
/// <param name="obj"></param>
private static void ConfigureInjections(ConfigurationExpression configuration)
{
configuration.For<IRepository<UserDto>>().HttpContextScoped().Use<Repository<UserDto>>();
configuration.For<IUserRepository>().HttpContextScoped().Use<UserRepository>(); // this is necessary if we would like to use EF for example and make sure no 2 threads will access one DbContext.
// For demo purposes, Im using a single source throughout the whole app.
configuration.For<IFeedSource>().Singleton().Use((() =>
{
var source = new FeedSource<SimpleNewsGator>();
source.Subscribe(new FeedDispatcher(new FeedItemHub()));
source.Start();
return source;
}));
}
示例14: SetDefaultClickatellClient
private static void SetDefaultClickatellClient(ClickatellConfigFileSettings clickatellConfigFileSettings,
ConfigurationExpression x)
{
var clickatellClient = new ClickatellClient(clickatellConfigFileSettings);
x.For<ClickatellClient>()
.Use(new IgnoreAuthErrorClickatellClient(clickatellConfigFileSettings,
new IgnoreNoCreditErrorClickatellClient(clickatellConfigFileSettings, clickatellClient)));
}
示例15: Configure
public void Configure(ConfigurationExpression cfg, IFoundationConfigurator foundationConfigurator)
{
if (foundationConfigurator.UsePresistence)
{
cfg.AddRegistry(new PersistenceRegistery());
cfg.For<IConnectionString>()
.Use(new ConnectionString(foundationConfigurator.Persistence.ConnectionStringKeyName));
}
}