• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IComponentRegistry类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IComponentRegistry的典型用法代码示例。如果您正苦于以下问题:C# IComponentRegistry类的具体用法?C# IComponentRegistry怎么用?C# IComponentRegistry使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IComponentRegistry类属于命名空间,在下文中一共展示了IComponentRegistry类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(IComponentRegistry registry, IComponentRegistration registration)
 {
   registration.Preparing += (s, e) =>
   {
     e.Parameters = new [] { loggerParameter }.Concat(e.Parameters);
   };
 }
开发者ID:ChrisMH,项目名称:Utility.Logging,代码行数:7,代码来源:NLogLoggerAutofacModule.cs


示例2: AttachToComponentRegistration

    protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
    {
      var type = registration.Activator.LimitType;  //  AF2.0+
      //  .Descriptor.BestKnownImplementationType;  //  AF1.2+

      //  we hook preparing to inject the logger into the constructor
      registration.Preparing += OnComponentPreparing;

      // build the list of actions for type and assign loggers to properties
      var injectors = BuildLogPropertyInjectors(type);

      // no logger properties, no need to hook up the event
// ReSharper disable PossibleMultipleEnumeration
      if (!injectors.Any())
// ReSharper restore PossibleMultipleEnumeration
        return;

      // we hook acticating to inject the logger into the known public properties
      registration.Activating += (s, e) =>
      {
// ReSharper disable PossibleMultipleEnumeration
        foreach (var injector in injectors)
// ReSharper restore PossibleMultipleEnumeration
          injector(e.Context, e.Instance);
      };
    }
开发者ID:dbuksbaum,项目名称:Hazware.Core,代码行数:26,代码来源:AbstractLoggingRegistrationModule.cs


示例3: Configure

 public void Configure(IComponentRegistry componentRegistry)
 {
     componentRegistry.Registered += (s, e) =>
     {
         e.ComponentRegistration.Preparing += OnComponentPreparing;
     };
 }
开发者ID:hircjusz,项目名称:AngularJsShop,代码行数:7,代码来源:AutofacConfig.cs


示例4: CopyOnWriteRegistry

 public CopyOnWriteRegistry(IComponentRegistry readRegistry, Func<IComponentRegistry> createWriteRegistry)
 {
     if (readRegistry == null) throw new ArgumentNullException("readRegistry");
     if (createWriteRegistry == null) throw new ArgumentNullException("createWriteRegistry");
     _readRegistry = readRegistry;
     _createWriteRegistry = createWriteRegistry;
 }
开发者ID:dstimac,项目名称:revenj,代码行数:7,代码来源:CopyOnWriteRegistry.cs


示例5: Configure

        public void Configure(IComponentRegistry componentRegistry)
        {
            var builder = new ContainerBuilder();

            if (_atomicStorageFactory == null)
            {
                AtomicIsInMemory(strategyBuilder => { });
            }
            if (_streamingRoot == null)
            {
                StreamingIsInFiles(Directory.GetCurrentDirectory());
            }
            if (_tapeStorage == null)
            {
                TapeIsInMemory();
            }

            var core = new AtomicRegistrationCore(_atomicStorageFactory);
            var source = new AtomicRegistrationSource(core);
            builder.RegisterSource(source);
            builder.RegisterInstance(new NuclearStorage(_atomicStorageFactory));
            builder
                .Register(
                    c => new AtomicStorageInitialization(new[] {_atomicStorageFactory}, c.Resolve<ISystemObserver>()))
                .As<IEngineProcess>().SingleInstance();

            builder.RegisterInstance(_streamingRoot);

            builder.RegisterInstance(_tapeStorage);
            builder.RegisterInstance(new TapeStorageInitilization(new[] {_tapeStorage})).As<IEngineProcess>();

            builder.Update(componentRegistry);
        }
开发者ID:higheredgrowth,项目名称:lokad-cqrs,代码行数:33,代码来源:StorageModule.cs


示例6: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(
     IComponentRegistry componentRegistry,
     IComponentRegistration registration)
 {
     registration.Preparing += (sender, args) =>
         log.Debug([email protected]"Resolving concrete type {args.Component.Activator.LimitType}");
 }
开发者ID:piriej,项目名称:Assignment3,代码行数:7,代码来源:ContainerSpecimenBuilder.cs


示例7: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
 {
     registration.Preparing += (sender, args) =>
         {
             args.Parameters = args.Parameters.Union( new[] { new NamedParameter(@"basePoint", _basePoint) } );
         };
 }
开发者ID:gofixiao,项目名称:Macsauto-Backup,代码行数:7,代码来源:InfrastructureModule.cs


示例8: RegistrationSourceAddedEventArgs

 /// <summary>
 /// Construct an instance of the <see cref="RegistrationSourceAddedEventArgs"/> class.
 /// </summary>
 /// <param name="componentRegistry">The registry to which the source was added.</param>
 /// <param name="registrationSource">The source that was added.</param>
 /// <exception cref="ArgumentNullException"></exception>
 public RegistrationSourceAddedEventArgs(IComponentRegistry componentRegistry, IRegistrationSource registrationSource)
 {
     if (componentRegistry == null) throw new ArgumentNullException("componentRegistry");
     if (registrationSource == null) throw new ArgumentNullException("registrationSource");
     _componentRegistry = componentRegistry;
     _registrationSource = registrationSource;
 }
开发者ID:RoymanJing,项目名称:Autofac,代码行数:13,代码来源:RegistrationSourceAddedEventArgs.cs


示例9: AttachToComponentRegistration

		protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry,
			IComponentRegistration registration)
		{
			registration.Preparing += RegistrationOnPreparing;
			registration.Activating += RegistrationOnActivating;
			base.AttachToComponentRegistration(componentRegistry, registration);
		}
开发者ID:tzachshabtay,项目名称:MonoAGS,代码行数:7,代码来源:AutofacResolveLoggingModule.cs


示例10: AttachToComponentRegistration

        protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
        {
            var implementationType = registration.Activator.LimitType;

            foreach (var autoWireType in autoWireTypes)
            {
                var constructors = implementationType.GetConstructorsWithDependency(autoWireType);

                if (constructors.Any())
                {
                    registration.Preparing += (sender, e) =>
                    {
                        var parameter = new TypedParameter(autoWireType,
                            e.Context.Resolve(autoWireType, new TypedParameter(typeof(Type), implementationType)));
                        e.Parameters = e.Parameters.Concat(new[] { parameter });
                    };
                }
                else
                {
                    var props = implementationType.GetPropertiesWithDependency(autoWireType);
                    if (props.Any())
                    {
                        registration.Activated += (s, e) =>
                        {
                            foreach (var prop in props)
                            {
                                prop.SetValue(e.Instance,
                                    e.Context.Resolve(autoWireType));
                            }
                        };
                    }
                }
            }

            foreach (var serviceType in typebasedServiceTypes)
            {
                var constructorInjectors = BuildConstructorServiceInjectors(implementationType, serviceType).ToArray();
                if (constructorInjectors.Any())
                {
                    registration.Preparing += (s, e) =>
                    {
                        foreach (var ci in constructorInjectors)
                            ci(e);
                    };
                    return;
                }

                // build an array of actions on this type to assign loggers to member properties
                var injectors = BuildPropertyServiceInjectors(implementationType, serviceType).ToArray();

                if (injectors.Any())
                {
                    registration.Activated += (s, e) =>
                    {
                        foreach (var injector in injectors)
                            injector(e.Context, e.Instance);
                    };
                }
            }
        }
开发者ID:cairabbit,项目名称:daf,代码行数:60,代码来源:AttachComponentModule.cs


示例11: LifetimeScope

 /// <summary>
 /// Create a root lifetime scope for the provided components.
 /// </summary>
 /// <param name="tag">The tag applied to the <see cref="ILifetimeScope"/>.</param>
 /// <param name="componentRegistry">Components used in the scope.</param>
 public LifetimeScope(IComponentRegistry componentRegistry, object tag)
     : this()
 {
     _componentRegistry = Enforce.ArgumentNotNull(componentRegistry, "componentRegistry");
     _root = this;
     _tag = Enforce.ArgumentNotNull(tag, "tag");
 }
开发者ID:yuleyule66,项目名称:autofac,代码行数:12,代码来源:LifetimeScope.cs


示例12: AttachToRegistrationSource

        protected override void AttachToRegistrationSource(IComponentRegistry componentRegistry, IRegistrationSource registrationSource)
        {
            base.AttachToRegistrationSource(componentRegistry, registrationSource);

            var message = new RegistrationSourceAddedMessage(_modelMapper.GetRegistrationSourceModel(registrationSource));
            Send(message);
        }
开发者ID:mustafatig,项目名称:whitebox,代码行数:7,代码来源:WhiteboxProfilingModule.cs


示例13: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
 {
     registration.Activating += (sender, e) =>
     {
         if (typeof (IMessageConsumer).IsAssignableFrom(e.Instance.GetType()))
             consumerInterceptor.ItemCreated(e.Instance.GetType(), e.Component.Lifetime.GetType().Equals(typeof(CurrentScopeLifetime)));
     };
 }
开发者ID:BiYiTuan,项目名称:rhino-esb,代码行数:8,代码来源:ConsumerInterceptorModule.cs


示例14: AttachToComponentRegistration

		protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
		{
			registration.Preparing += (sender, args) => args.Parameters = args.Parameters.Concat(new[]
			{
				new ResolvedParameter((info, context) => info.ParameterType == typeof (ILog),
					(info, context) => _logFactory(info.Member.DeclaringType))
			});
		}
开发者ID:patterns-group,项目名称:code-patterns,代码行数:8,代码来源:LoggingModule.cs


示例15: RegistrationSourceAddedEventArgs

        /// <summary>
        /// Construct an instance of the <see cref="RegistrationSourceAddedEventArgs"/> class.
        /// </summary>
        /// <param name="componentRegistry">The registry to which the source was added.</param>
        /// <param name="registrationSource">The source that was added.</param>
        /// <exception cref="ArgumentNullException"></exception>
        public RegistrationSourceAddedEventArgs(IComponentRegistry componentRegistry, IRegistrationSource registrationSource)
        {
            if (componentRegistry == null) throw new ArgumentNullException(nameof(componentRegistry));
            if (registrationSource == null) throw new ArgumentNullException(nameof(registrationSource));

            ComponentRegistry = componentRegistry;
            RegistrationSource = registrationSource;
        }
开发者ID:arronchen,项目名称:Autofac,代码行数:14,代码来源:RegistrationSourceAddedEventArgs.cs


示例16: AttachToComponentRegistration

        protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
        {
            // Handle constructor parameters.
            registration.Preparing += OnComponentPreparing;

            // Handle properties.
            registration.Activated += (sender, e) => InjectLoggerProperties(e.Instance);
        }
开发者ID:johnnyreilly,项目名称:proverb-api,代码行数:8,代码来源:LoggingModule.cs


示例17: ComponentRegisteredEventArgs

        /// <summary>
        /// Initializes a new instance of the <see cref="ComponentRegisteredEventArgs"/> class.
        /// </summary>
        /// <param name="registry">The container into which the registration
        /// was made.</param>
        /// <param name="componentRegistration">The component registration.</param>
        public ComponentRegisteredEventArgs(IComponentRegistry registry, IComponentRegistration componentRegistration)
        {
            if (registry == null) throw new ArgumentNullException(nameof(registry));
            if (componentRegistration == null) throw new ArgumentNullException(nameof(componentRegistration));

            ComponentRegistry = registry;
            ComponentRegistration = componentRegistration;
        }
开发者ID:GitHuang,项目名称:Autofac,代码行数:14,代码来源:ComponentRegisteredEventArgs.cs


示例18: Configure

        public void Configure(IComponentRegistry componentRegistry)
        {
            // This is necessary as generic dependencies are currently not resolved, see issue: http://orchard.codeplex.com/workitem/18141
            var builder = new ContainerBuilder();
            builder.RegisterGeneric(typeof(Resolve<>)).As(typeof(IResolve<>));

            builder.Update(componentRegistry);
        }
开发者ID:wezmag,项目名称:Coevery,代码行数:8,代码来源:DependencyInjectionModule.cs


示例19: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
 {
     Type implementationType = registration.Activator.LimitType;
     if (DynamicProxyContext.From(registration) != null && implementationType.FullName == "Orchard.Car.Services.CarInfoService")
     {
         registration.InterceptedBy<SimpleInterceptor>();
     }
 }
开发者ID:huhan,项目名称:OrchardNoCMS,代码行数:8,代码来源:SimpleInterceptorModule.cs


示例20: AttachToComponentRegistration

 protected override void AttachToComponentRegistration(IComponentRegistry componentRegistry, IComponentRegistration registration)
 {
     // Use the event args to log detailed info
     registration.Preparing += (sender, args) =>                      
         Debug.WriteLine(
             "Resolving concrete type {0}, Id {1}",
             args.Component.Activator.LimitType, args.Component.Id.ToString());
 }
开发者ID:darrenschwarz,项目名称:Karama.Identity.Net46,代码行数:8,代码来源:LogRequestsModule.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ICompositionElement类代码示例发布时间:2022-05-24
下一篇:
C# IComponentRegistration类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap