本文整理汇总了C#中ConfigurationExpression类的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationExpression类的具体用法?C# ConfigurationExpression怎么用?C# ConfigurationExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationExpression类属于命名空间,在下文中一共展示了ConfigurationExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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));
}
示例2: 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());
}
示例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: ConfigureContainer
private static void ConfigureContainer(ConfigurationExpression container)
{
//Swap out the default ContentRenderer for our custom
container.For<IContentRenderer>().Use<ErrorHandlingContentRenderer>();
//Implementations for custom interfaces can be registered here.
}
示例5: 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");
}
示例6: 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)));
}
示例7: Configure
protected override void Configure(ConfigurationExpression cfg)
{
cfg.Scan(x =>
{
x.TheCallingAssembly();
x.LookForRegistries();
});
}
示例8: For
public static IPipelineGraph For(Action<ConfigurationExpression> action)
{
var expression = new ConfigurationExpression();
action(expression);
var graph = expression.BuildGraph();
return BuildRoot(graph);
}
示例9: SecurityContext
private SecurityContext(ConfigurationExpression configurationExpression)
{
_data = new ExpandoObject();
_isAuthenticated = configurationExpression.IsAuthenticated;
_roles = configurationExpression.Roles;
var modifyer = configurationExpression.Advanced.SecurityContextModifyer;
if (modifyer != null) modifyer.Invoke(this);
}
示例10: For
public static RootPipelineGraph For(Action<ConfigurationExpression> action)
{
var expression = new ConfigurationExpression();
action(expression);
PluginGraph graph = expression.BuildGraph();
return new RootPipelineGraph(graph);
}
示例11: Configure
public void Configure(ConfigurationExpression cfg, IFoundationConfigurator foundationConfigurator)
{
if (foundationConfigurator.UsePresistence)
{
cfg.AddRegistry(new PersistenceRegistery());
cfg.For<IConnectionString>()
.Use(new ConnectionString(foundationConfigurator.Persistence.ConnectionStringKeyName));
}
}
示例12: SetupContainer
private static void SetupContainer(ConfigurationExpression x)
{
x.Scan(i =>
{
i.TheCallingAssembly();
i.Convention<SettingsScanner>();
});
x.SetAllProperties(s => s.Matching(p => p.Name.EndsWith("Settings")));
}
示例13: 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>();
}
示例14: 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);
}
示例15: ConfigureContainer
private static void ConfigureContainer(ConfigurationExpression container)
{
container.For<IFormSerializer>().Use<FormSerializer>();
container.For<IFormFieldSerializeUtils>().Use<FormFieldSerializeUtils>();
container.For<IFormFieldModelBuilder>().Use<FormFieldModelBuilder>();
container.For<IXFormBuilder>().Use<XFormBuilder>();
container.For<IFormTypeModelSynchronizer>().Use<FormTypeModelSynchronizer>();
container.For<IFormFieldTypeSynchronizer>().Use<FormFieldTypeSynchronizer>();
}