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


C# IComponentRegistry类代码示例

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


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


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