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


C# IConnectionFactory类代码示例

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


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

示例1: RabbitResourceHolder

 public RabbitResourceHolder(IConnectionFactory connectionFactory, IConnection connection, IModel channel)
 {
     this.connectionFactory = connectionFactory;
     AddConnection(connection);
     AddChannel(channel);
     this.frozen = true;
 }
开发者ID:moprise,项目名称:spring-net-amqp,代码行数:7,代码来源:RabbitResourceHolder.cs

示例2: SharedConnectionPoolFactory

 public SharedConnectionPoolFactory(
     IConnectionFactory connectionFactory,
     ConnectionPoolSettings connectionPoolSettings)
 {
     _connectionFactory = Ensure.IsNotNull(connectionFactory, "connectionFactory");
     _connectionPoolSettings = Ensure.IsNotNull(connectionPoolSettings, "connectionPoolSettings");
 }
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:7,代码来源:SharedConnectionPoolFactory.cs

示例3: PersistentConnection

        public PersistentConnection(IConnectionFactory connectionFactory, IEasyNetQLogger logger)
        {
            this.connectionFactory = connectionFactory;
            this.logger = logger;

            TryToConnect(null);
        }
开发者ID:negy,项目名称:EasyNetQ,代码行数:7,代码来源:PersistentConnection.cs

示例4: Db

 /// <summary>
 /// Instantiate Db with connectionString and a custom IConnectionFactory
 /// </summary>
 /// <param name="connectionString">the connection string</param>
 /// <param name="config"></param>
 /// <param name="connectionFactory">the connection factory</param>
 internal Db(string connectionString, DbConfig config, IConnectionFactory connectionFactory = null)
 {
     _connectionString = connectionString;
     _connectionFactory = connectionFactory ?? new AdoNetProviderFactory(config.ProviderName);
     _connection = new Lazy<IDbConnection>(CreateConnection);
     Config = config;
 }
开发者ID:jhgbrt,项目名称:yadal,代码行数:13,代码来源:Db.cs

示例5: Setup

      public void Setup()
      {
         factory = A.Fake<IConnectionFactory>();
         fakeHttp = A.Fake<ISimpleHttpGetRequest>();
         fakeWebSocket = A.Fake<IWebSocket>();
         heartBeatSignaler = A.Fake<IHeartBeatSignaler>();

         A.CallTo(() => factory.CreateHttpRequest(A<string>._)).Returns(fakeHttp);
         A.CallTo(() => fakeHttp.Execute()).ReturnsLazily(() => handshakeResponse);
         A.CallTo(() => factory.CreateWebSocket(A<string>._)).Returns(fakeWebSocket);
         A.CallTo(() => fakeWebSocket.Connected).ReturnsLazily(() => isConnected);

         A.CallTo(() => fakeWebSocket.Open()).Invokes(() =>
         {
            isConnected = true;
            fakeWebSocket.Opened += Raise.With(fakeWebSocket, EventArgs.Empty).Now;
         });

         A.CallTo(() => fakeWebSocket.Close()).Invokes(() =>
         {
            isConnected = false;
            fakeWebSocket.Closed += Raise.With(fakeWebSocket, EventArgs.Empty).Now;
         });

         io = new SocketIOClient(factory, heartBeatSignaler);

         socket = io.Connect("http://localhost:3000");
      }
开发者ID:hjhome2000,项目名称:socket.io-csharp-client,代码行数:28,代码来源:Client.cs

示例6: InheritedSqlPersistenceEngine

 public InheritedSqlPersistenceEngine(
     IConnectionFactory connectionFactory,
     ISqlDialect dialect,
     ISerialize serializer,
     TransactionScopeOption scopeOption, int pageSize) 
     : base(connectionFactory, dialect, serializer, scopeOption, pageSize)
 {}
开发者ID:hawkins6423,项目名称:NEventStore,代码行数:7,代码来源:SqlPersistenceEngineTests.cs

示例7: LinearBlockIdGenerator

 public LinearBlockIdGenerator(IConnectionFactory connectionFactory, int range, string dimension, string tablePrefix)
 {
     _connectionFactory = connectionFactory;
     _range = range;
     _tablePrefix = tablePrefix;
     _dimension = dimension;
 }
开发者ID:SmartFire,项目名称:yessql,代码行数:7,代码来源:LinearBlockIdGenerator.cs

示例8: CreateMocks

        private void CreateMocks()
        {
            mockConnectionFactory = (IConnectionFactory) mocks.CreateMock(typeof (IConnectionFactory));
            mockConnection = (IConnection) mocks.CreateMock(typeof (IConnection));
            mockSession = (ISession) mocks.CreateMock(typeof (ISession));

            TIBCO.EMS.Queue queue = new TIBCO.EMS.Queue("test"); //(Queue) mocks.CreateMock(typeof (Queue));

            Expect.Call(mockConnectionFactory.CreateConnection()).Return(mockConnection).Repeat.Once();
            if (UseTransactedTemplate)
            {
                Expect.Call(mockConnection.CreateSession(true, Session.SESSION_TRANSACTED)).Return(mockSession).Repeat.
                    Once();
            }
            else
            {
                Expect.Call(mockConnection.CreateSession(false, Session.AUTO_ACKNOWLEDGE)).Return(mockSession).
                    Repeat.
                    Once();
            }
            Expect.Call(mockSession.Transacted).Return(true);

            mockDestinationResolver =
                (IDestinationResolver) mocks.CreateMock(typeof (IDestinationResolver));
            mockDestinationResolver.ResolveDestinationName(mockSession, "testDestination", false);
            LastCall.Return(queue).Repeat.Any();
        }
开发者ID:fgq841103,项目名称:spring-net,代码行数:27,代码来源:MessageTemplateTests.cs

示例9: PersistentConnection

        public PersistentConnection(IConnectionFactory connectionFactory, TimeSpan retryDelay)
        {
            this.connectionFactory = connectionFactory;
            this.retryDelay = retryDelay;

            TryToConnect(null);
        }
开发者ID:laxmanrapolu,项目名称:NserviceBusDemo,代码行数:7,代码来源:PersistentConnection.cs

示例10: ServerFactory

 // constructors
 public ServerFactory(ServerSettings settings, IConnectionPoolFactory connectionPoolFactory, IConnectionFactory heartbeatConnectionFactory, IServerListener listener)
 {
     _settings = Ensure.IsNotNull(settings, "settings");
     _connectionPoolFactory = Ensure.IsNotNull(connectionPoolFactory, "connectionPoolFactory");
     _heartbeatConnectionFactory = Ensure.IsNotNull(heartbeatConnectionFactory, "heartbeatConnectionFactory");
     _listener = listener;
 }
开发者ID:Nakro,项目名称:mongo-csharp-driver,代码行数:8,代码来源:ServerFactory.cs

示例11: ConnectionPool

 public ConnectionPool( RedisConfiguration configuration, IConnectionFactory connectionFactory )
 {
     Configuration = configuration;
     ConnectionFactory = connectionFactory;
     AvailableConnections = new ConcurrentQueue<IConnection>();
     ReservedConnections = new ConcurrentDictionary<IConnection, IConnection>();
 }
开发者ID:cmgator,项目名称:Symbiote,代码行数:7,代码来源:ConnectionPool.cs

示例12: CustomerAgent

 public CustomerAgent(IConnectionFactory ConnectionFactory,
     CustomerFactory Factory, CustomerAppService CustomerAppService)
 {
     this.Factory = Factory;
     this.ConnectionFactory = ConnectionFactory;
     this.CustomerAppService = CustomerAppService;
 }
开发者ID:gcvalderrama,项目名称:netcell,代码行数:7,代码来源:CustomerAgent.cs

示例13: Connection

        /// <summary>
        /// Initializes a new instance of the <see cref="Connection"/> class.
        /// </summary>
        /// <param name="factory">The pool.</param>
        public Connection(IConnectionFactory factory)
        {
            if (factory == null)
                throw new ArgumentNullException ("factory");

            _factory = factory;
        }
开发者ID:ningliaoyuan,项目名称:Antaeus,代码行数:11,代码来源:Connection.cs

示例14: ExclusiveConnectionPool

        // constructors
        public ExclusiveConnectionPool(
            ServerId serverId,
            EndPoint endPoint,
            ConnectionPoolSettings settings,
            IConnectionFactory connectionFactory,
            IEventSubscriber eventSubscriber)
        {
            _serverId = Ensure.IsNotNull(serverId, nameof(serverId));
            _endPoint = Ensure.IsNotNull(endPoint, nameof(endPoint));
            _settings = Ensure.IsNotNull(settings, nameof(settings));
            _connectionFactory = Ensure.IsNotNull(connectionFactory, nameof(connectionFactory));
            Ensure.IsNotNull(eventSubscriber, nameof(eventSubscriber));

            _connectionHolder = new ListConnectionHolder(eventSubscriber);
            _poolQueue = new WaitQueue(settings.MaxConnections);
            _waitQueue = new SemaphoreSlim(settings.WaitQueueSize);
            _maintenanceCancellationTokenSource = new CancellationTokenSource();
            _state = new InterlockedInt32(State.Initial);

            eventSubscriber.TryGetEventHandler(out _checkingOutConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _checkedOutConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _checkingOutConnectionFailedEventHandler);
            eventSubscriber.TryGetEventHandler(out _checkingInConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _checkedInConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _addingConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _addedConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _openingEventHandler);
            eventSubscriber.TryGetEventHandler(out _openedEventHandler);
            eventSubscriber.TryGetEventHandler(out _closingEventHandler);
            eventSubscriber.TryGetEventHandler(out _closedEventHandler);
            eventSubscriber.TryGetEventHandler(out _addingConnectionEventHandler);
            eventSubscriber.TryGetEventHandler(out _addedConnectionEventHandler);
        }
开发者ID:robblovell,项目名称:mongo-csharp-driver,代码行数:34,代码来源:ExclusiveConnectionPool.cs

示例15: Queue

        public Queue(MsgDeliveryMode mode = MsgDeliveryMode.NonPersistent)
        {
            Uri msgQueue = new Uri("activemq:tcp://localhost:61616");

            _factory = new ConnectionFactory(msgQueue);
            try
            {
                _connection = _factory.CreateConnection();
            }
            catch (NMSConnectionException ex)
            {
                Log.FatalException("Error connecting to MQ server", ex);
                throw;
            }
            // TODO check _connection for null
            _connection.RequestTimeout = TimeSpan.FromSeconds(60);
            Session = _connection.CreateSession();

            // TODO need to find out if queue exists.
            // It creates a new queue if it doesn't exist.
            _destination = Session.GetDestination("queue://TwitterSearchStream");
            _consumer = Session.CreateConsumer(_destination);

            _producer = Session.CreateProducer(_destination);
            _producer.RequestTimeout = TimeSpan.FromSeconds(60);
            _producer.DeliveryMode = mode;

            _connection.Start();

            _connection.ExceptionListener += _connection_ExceptionListener;
            _connection.ConnectionInterruptedListener += _connection_ConnectionInterruptedListener;
        }
开发者ID:cfmayer,项目名称:Toketee,代码行数:32,代码来源:Queue.cs


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