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


C# IComponentContext.ResolveNamed方法代码示例

本文整理汇总了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();
        }
开发者ID:slavo,项目名称:FunnelWeb,代码行数:26,代码来源:RepositoriesModule.cs

示例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);
        }
开发者ID:etishor,项目名称:NanoMessageBus,代码行数:8,代码来源:EndpointWireup.cs

示例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);
            }
        }
开发者ID:mindis,项目名称:Pipeline.Net,代码行数:36,代码来源:TransformFactory.cs

示例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());
 }
开发者ID:RebelCMS,项目名称:rebelcmsxu5,代码行数:11,代码来源:ConfigurationElementExtensions.cs

示例5: ResolveDealer

 public static Player ResolveDealer(IComponentContext componentContext)
 {
     return componentContext.ResolveNamed<Player>("dealer");
 }
开发者ID:Gwayaboy,项目名称:IyeTek.BlackJack,代码行数:4,代码来源:DealerModule.cs


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