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


C# IRegistration类代码示例

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


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

示例1: Register

 public virtual void Register(IRegistration registration)
 {
     lock (_registrationListLock)
     {
         _registrationList.Add(registration);
     }
 }
开发者ID:sjroot,项目名称:CMF,代码行数:7,代码来源:InMemoryEnvelopeBus.cs

示例2: Register

        public void Register(IRegistration registration)
        {
            _log.Debug("Enter Register");

            // first, get the topology based on the registration info
            RoutingInfo routing = _topoSvc.GetRoutingInfo(registration.Info);

            // next, pull out all the consumer exchanges
            IEnumerable<Exchange> exchanges =
                from route in routing.Routes
                select route.ConsumerExchange;

            foreach (Exchange ex in exchanges)
            {
                IConnection conn = _connFactory.ConnectTo(ex);

                // create a listener
                RabbitListener listener = new RabbitListener(registration, ex, conn);
                listener.OnEnvelopeReceived += this.listener_OnEnvelopeReceived;
                listener.OnClose += _listeners.Remove;

                // put it on another thread so as not to block this one
                Thread listenerThread = new Thread(listener.Start);
                listenerThread.Name = string.Format("{0} on {1}:{2}{3}", ex.QueueName, ex.HostName, ex.Port, ex.VirtualHost);
                listenerThread.Start();

                // store the listener
                _listeners.Add(registration, listener);
            }

            _log.Debug("Leave Register");
        }
开发者ID:berico-tpinney,项目名称:AMP,代码行数:32,代码来源:RabbitTransportProvider.cs

示例3: Register

        public override void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
        {
            var mappedFromType = registration.GetMappedFromType();
            var mappedToType = registration.GetMappedToType();

            if (mappedFromType != mappedToType)
            {
                adapter.RegisterFactoryMethod(mappedFromType, () => pipeline.Execute(mappedFromType));
                RegisterLazy(adapter, mappedFromType, pipeline);
                adapter.Register(mappedToType, mappedToType);
                RegisterContextual(adapter, mappedToType);
            }
            else
            {
                var serviceLocator = adapter.GetInstance<IServiceLocator>();
                adapter.RegisterFactoryMethod(mappedToType, () =>
                {
                    var instance = serviceLocator.GetInstance(mappedToType, "default." + mappedToType, new IResolutionArgument[0]);
                    return instance;
                });
                serviceLocator.Register(new NamedRegistration(mappedToType, mappedToType, "default." + mappedToType));
            }

            RegisterLazy(adapter, mappedToType, pipeline);
            RegisterTypeResolver(adapter, mappedFromType);
            RegisterContextual(adapter, mappedFromType);
        }
开发者ID:ot-dan-smith,项目名称:Siege,代码行数:27,代码来源:DefaultRegistrationTemplate.cs

示例4: Add

        public void Add(IRegistration registration)
        {
            if (registration.Key == null)
            {
                // Default
                _defaultIndex.Add(registration.Type, registration);
            }
            else
            {
                // Keyed

                Dictionary<object, IRegistration> keyedEntry;
                if (_keyedIndex.TryGetValue(registration.Type, out keyedEntry))
                {
                    // Add to already existing entry
                    keyedEntry.Add(registration.Key, registration);
                }
                else
                {
                    // Add new keyed entry
                    keyedEntry = new Dictionary<object, IRegistration>();
                    keyedEntry.Add(registration.Key, registration);
                    _keyedIndex.Add(registration.Type, keyedEntry);
                }
            }
        }
开发者ID:thanhvc,项目名称:DynamoIOC,代码行数:26,代码来源:DirectIndex.cs

示例5: Unregister

 public virtual void Unregister(IRegistration registration)
 {
     lock (_registrationListLock)
     {
         _registrationList.Remove(registration);
     }
 }
开发者ID:sjroot,项目名称:CMF,代码行数:7,代码来源:InMemoryEnvelopeBus.cs

示例6: createListener

        protected RabbitListener createListener(IRegistration registration, Exchange exchange)
        {
            // create a channel
            var connection = _connFactory.ConnectTo(exchange);

            // create a listener
            RabbitListener listener = new RabbitListener(registration, exchange, connection);
            listener.OnEnvelopeReceived += dispatcher =>
                {
                    Log.Debug("Got an envelope from the RabbitListener: dispatching.");
                    // the dispatcher encapsulates the logic of giving the envelope to handlers
                    dispatcher.Dispatch();
                };
            listener.OnClose += _listeners.Remove;

            //TODO: Resolve that RabbitListener does not implement OnConnectionError
            //listener.OnConnectionError(new ReconnectOnConnectionErrorCallback(_channelFactory));

            // store the listener
            _listeners.Add(registration, listener);

            // put it on another thread so as not to block this one
            // don't continue on this thread until we've started listening
            ManualResetEvent startEvent = new ManualResetEvent(false);
            Thread listenerThread = new Thread(listener.Start);
            listenerThread.Name = string.Format("{0} on {1}:{2}{3}", exchange.QueueName, exchange.HostName, exchange.Port, exchange.VirtualHost);
            listenerThread.Start(startEvent);

            return listener;
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:30,代码来源:RabbitEnvelopeReceiver.cs

示例7: TeamProjects

        /// <summary>
        ///     Initializes a new instance of the <see cref="TeamProjects" /> class.
        /// </summary>
        /// <param name="tfsCollectionUri">The TFS collection URI.</param>
        /// <param name="tfsCredentials">The TFS credentials.</param>
        public TeamProjects(Uri tfsCollectionUri, ITfsCredentials tfsCredentials)
        {
            this._tfsCollectionUri = tfsCollectionUri;
            this._tfsTeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsCollectionUri, tfsCredentials);

            this._registration = (IRegistration)this._tfsTeamProjectCollection.GetService(typeof(IRegistration));
            this._commonStructureService = this._tfsTeamProjectCollection.GetService<ICommonStructureService>();
        }
开发者ID:devoneonline,项目名称:Tfs-Api,代码行数:13,代码来源:TeamProjects.cs

示例8: PropertyFacilityRegistration

 public PropertyFacilityRegistration(IRegistration inner, FinalRegistrationOptions options) {
     if (inner == null)
         throw new ArgumentNullException("inner", "inner is null.");
     if (options == null)
         throw new ArgumentNullException("options", "options is null.");
     _options = options;
     _inner = inner;
 }
开发者ID:mgagne-atman,项目名称:Projects,代码行数:8,代码来源:PropertyFacilityRegistration.cs

示例9: GetInstance

        public override object GetInstance(IContainer container, IRegistration registration)
        {
            if (IsDisposed) throw new ObjectDisposedException("ThreadStaticContainerLifecycle");

            var lifecycle = GetThreadStaticLifecycle();

            return lifecycle.GetInstance(container, registration);
        }
开发者ID:bradleyjford,项目名称:inception,代码行数:8,代码来源:ThreadStaticContainerLifecycle.cs

示例10: RabbitListener

        public RabbitListener(IRegistration registration, Exchange exchange, IConnection connection)
        {
            _registration = registration;
            _exchange = exchange;
            _connection = connection;

            _log = LogManager.GetLogger(this.GetType());
        }
开发者ID:berico-tpinney,项目名称:AMP,代码行数:8,代码来源:RabbitListener.cs

示例11: InvalidateInstanceCache

        /// <summary>
        /// Removes the instance for the registration from the local storage cache.
        /// </summary>
        /// <param name="registration">The IRegistration returned when the type was registered in the IOC container.</param>
        public void InvalidateInstanceCache(IRegistration registration)
        {
            // nothing stored yet
            if (localStorage == null)
                return;

            localStorage.Remove(registration.Key);
        }
开发者ID:ehsan-davoudi,项目名称:webstack,代码行数:12,代码来源:ThreadLocalStorageLifetime.cs

示例12: FuncNoKeyRegistration

        public FuncNoKeyRegistration(IRegistration delegateRegistration)
        {
            this.delegateRegistration = delegateRegistration;
            this.funcType = Expression.GetFuncType(Type.GetTypeFromHandle(delegateRegistration.TypeHandle)).TypeHandle;

            var registrationContext = Expression.Parameter(typeof(IRegistrationContext), "registrationContext");
            this.generator = Expression.Lambda<Func<IRegistrationContext, object>>(this.GetInstanceExpression(registrationContext), registrationContext).Compile();
        }
开发者ID:modulexcite,项目名称:Stylet,代码行数:8,代码来源:FuncNoKeyRegistration.cs

示例13: TeamProjectCollections

 public TeamProjectCollections(Uri tfsUri, ITfsCredentials tfsCredentials)
 {
     this._tfsUri = tfsUri;
     this._tfsCredentials = tfsCredentials;
     this._tfsTeamProjectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(tfsUri, this._tfsCredentials);
     this._tfsConfigurationServer = this._tfsTeamProjectCollection.GetConfigurationServer();
     this._registration = (IRegistration)this._tfsTeamProjectCollection.GetService(typeof(IRegistration));
     this._teamProjectCollectionService = this._tfsConfigurationServer.GetService<ITeamProjectCollectionService>();
 }
开发者ID:devoneonline,项目名称:Tfs-Api,代码行数:9,代码来源:TeamProjectCollections.cs

示例14: Register

        public override void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
        {
            var namedRegistration = (INamedRegistration)registration;

            var mappedTo = registration.GetMappedTo();

            adapter.RegisterInstanceWithName(registration.GetMappedToType(), mappedTo, namedRegistration.Key);
            adapter.RegisterInstanceWithName(registration.GetMappedFromType(), mappedTo, namedRegistration.Key);
        }
开发者ID:rexwhitten,项目名称:Siege,代码行数:9,代码来源:NamedInstanceRegistrationTemplate.cs

示例15: Register

        public void Register(IServiceLocatorAdapter adapter, IServiceLocatorStore store, IRegistration registration, ResolutionPipeline pipeline)
        {
            if (registration is ConstructorRegistration)
            {
                var constructorRegistration = registration as ConstructorRegistration;

                store.Get<IInjectionOverrideStore>().Add(constructorRegistration.Arguments);
            }
        }
开发者ID:adamjmoon,项目名称:Siege,代码行数:9,代码来源:InjectionOverrideRegistrationTemplate.cs


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