本文整理汇总了C#中IComponentContext.ResolveNamed方法的典型用法代码示例。如果您正苦于以下问题:C# IComponentContext.ResolveNamed方法的具体用法?C# IComponentContext.ResolveNamed怎么用?C# IComponentContext.ResolveNamed使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IComponentContext
的用法示例。
在下文中一共展示了IComponentContext.ResolveNamed方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConfigureSessionFactory
private static ISessionFactory ConfigureSessionFactory(IComponentContext context)
{
var connectionStringProvider = context.Resolve<IConnectionStringProvider>();
EntryMapping.CurrentSchema = connectionStringProvider.Schema;
var databaseProvider = context.ResolveNamed<IDatabaseProvider>(connectionStringProvider.DatabaseProvider.ToLower());
var databaseConfiguration = databaseProvider.GetDatabaseConfiguration(connectionStringProvider);
var configuration =
Fluently
.Configure()
.Database(databaseConfiguration)
.Mappings(m =>
{
m.FluentMappings.AddFromAssembly(System.Reflection.Assembly.GetExecutingAssembly());
//Scan extensions for nHibernate mappings
var extension = context.Resolve<IEnumerable<ScriptedExtension>>();
foreach (var assembly in extension.Select(provider => provider.SourceAssembly))
{
m.FluentMappings.AddFromAssembly(assembly);
}
})
.ProxyFactoryFactory(typeof (DefaultProxyFactoryFactory));
return configuration.BuildSessionFactory();
}
示例2: BuildPoisonMessageHandler
protected virtual IHandlePoisonMessages BuildPoisonMessageHandler(IComponentContext c)
{
if (!this.enlist)
return new NonTransactionalPoisonMessageHandler();
return new PoisonMessageHandler(
c.ResolveNamed<ISendToEndpoints>(PoisonEndpoint, new Parameter[0]), new Uri(this.poisonAddress), this.maxRetries,this.postHandlingAction);
}
示例3: SwitchTransform
public static ITransform SwitchTransform(IComponentContext ctx, PipelineContext context) {
context.Activity = PipelineActivity.Transform;
switch (context.Transform.Method) {
case "format": return new FormatTransform(context);
case "left": return new LeftTransform(context);
case "right": return new RightTransform(context);
case "copy": return new CopyTransform(context);
case "concat": return new ConcatTransform(context);
case "fromxml": return new FromXmlTransform(context);
case "fromsplit": return new FromSplitTransform(context);
case "htmldecode": return new DecodeTransform(context);
case "xmldecode": return new DecodeTransform(context);
case "hashcode": return new HashcodeTransform(context);
case "padleft": return new PadLeftTransform(context);
case "padright": return new PadRightTransform(context);
case "splitlength": return new SplitLengthTransform(context);
case "timezone": return new TimeZoneOperation(context);
case "trim": return new TrimTransform(context);
case "trimstart": return new TrimStartTransform(context);
case "trimend": return new TrimEndTransform(context);
case "javascript": return new JintTransform(context);
case "tostring": return new ToStringTransform(context);
case "toupper": return new ToUpperTransform(context);
case "tolower": return new ToLowerTransform(context);
case "join": return new JoinTransform(context);
case "map": return new MapTransform(context, ctx.ResolveNamed<IMapReader>(context.Process.Maps.First(m => m.Name == context.Transform.Map).Key));
case "decompress": return new DecompressTransform(context);
case "contains": return new ContainsValidater(context);
case "is": return new IsValidator(context);
default:
context.Warn("The {0} method is undefined.", context.Transform.Method);
return new NullTransformer(context);
}
}
示例4: ResolveNamedPersistenceRepositoryProvider
/// <summary>
/// Resolves the named persistence reader using an <see cref="IComponentContext"/>.
/// </summary>
/// <param name="context">The context.</param>
/// <param name="providerElement">The provider element.</param>
/// <returns></returns>
/// <remarks></remarks>
private static object ResolveNamedPersistenceRepositoryProvider(IComponentContext context, PersistenceReaderElement providerElement)
{
return context.ResolveNamed(providerElement.InternalKey, providerElement.ToType());
}
示例5: ResolveDealer
public static Player ResolveDealer(IComponentContext componentContext)
{
return componentContext.ResolveNamed<Player>("dealer");
}