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

C# IRegistration类代码示例

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

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



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


示例16: Unregister

        public void Unregister(IRegistration registration)
        {
            RabbitListener listener;

            if (_listeners.TryGetValue(registration, out listener))
            {
                try { listener.Stop(); } catch { }
            }
        }
开发者ID:Berico-Technologies,项目名称:AMP,代码行数:9,代码来源:RabbitEnvelopeReceiver.cs


示例17: RabbitEnvelopeDispatcher

        public RabbitEnvelopeDispatcher(IRegistration registration, Envelope envelope, IModel channel, ulong deliveryTag)
        {
            _registration = registration;
            _channel = channel;
            _deliveryTag = deliveryTag;

            this.Envelope = envelope;

            _log = LogManager.GetLogger(this.GetType());
        }
开发者ID:jar349,项目名称:AMP,代码行数:10,代码来源:RabbitEnvelopeDispatcher.cs


示例18: GetMessage

		private static string GetMessage(IRegistration registration)
		{
			var msg = "Registration for type: " + registration.ReturnType;

			if (registration.Key != null)
				msg += " with key: " + registration.Key;

			msg += " is invalid.";

			return msg;
		}
开发者ID:Kingefosa,项目名称:Dynamo.IoC,代码行数:11,代码来源:InvalidRegistrationException.cs


示例19: Register

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

            adapter.RegisterFactoryMethod(mappedFromType, () => pipeline.Execute(mappedFromType));
            adapter.RegisterInstance(mappedToType, registration.GetMappedTo());
            RegisterLazy(adapter, mappedFromType, pipeline);
            RegisterLazy(adapter, mappedToType, pipeline);

            RegisterContextual(adapter, mappedFromType);
            RegisterContextual(adapter, mappedToType);
        }
开发者ID:adamjmoon,项目名称:Siege,代码行数:13,代码来源:ConditionalInstanceRegistrationTemplate.cs


示例20: Register

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

            var mappedToType = registration.GetMappedToType();
            var mappedFromType = registration.GetMappedFromType();

            adapter.RegisterWithName(mappedToType, mappedToType, namedRegistration.Key);
            adapter.RegisterWithName(mappedFromType, mappedToType, namedRegistration.Key);

            RegisterNamedLazy(adapter, mappedFromType, namedRegistration.Key);
            RegisterNamedLazy(adapter, mappedToType, namedRegistration.Key);
        }
开发者ID:adamjmoon,项目名称:Siege,代码行数:13,代码来源:NamedRegistrationTemplate.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IRegistry类代码示例发布时间:2022-05-24
下一篇:
C# IRegisteredPackageRepositories类代码示例发布时间: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