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


C# Address.ToString方法代码示例

本文整理汇总了C#中Address.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Address.ToString方法的具体用法?C# Address.ToString怎么用?C# Address.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Address的用法示例。


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

示例1: Unsubscribe

        public void Unsubscribe(Address client, IEnumerable<MessageType> messageTypes)
        {
            foreach (var key in GetMessageTypeKeys(messageTypes))
            {
                var query = Query.And(Query<Subscription>.EQ(s => s.Id, key), Query<Subscription>.EQ(s => s.Subscribers, client.ToString()));
                var update = Update<Subscription>.Pull(s => s.Subscribers, client.ToString());

                _subscriptions.Update(query, update, UpdateFlags.None);
            }
        }
开发者ID:Thuzi,项目名称:NServiceBus.Persistence.MongoDb,代码行数:10,代码来源:MongoDbSubscriptionPersistence.cs

示例2: Subscribe

        public void Subscribe(Address client, IEnumerable<MessageType> messageTypes)
        {
            foreach (var messageType in messageTypes)
            {
                if(_subscriptions.AsQueryable().Where(x => x.TypeName == messageType.TypeName && x.SubscriberEndpoint == client.ToString()).ToList().Any(x => new MessageType(x.TypeName, x.Version) == messageType))
                    continue;

                _subscriptions.Save(new Subscription
                                        {
                                            SubscriberEndpoint = client.ToString(),
                                            MessageType = messageType.TypeName + "," + messageType.Version,
                                            Version = messageType.Version.ToString(),
                                            TypeName = messageType.TypeName
                                        });
            }
        }
开发者ID:justinsaraceno,项目名称:NServicebus-Mongo,代码行数:16,代码来源:SubscriptionStorage.cs

示例3: Get

        public QueueClient Get(Address address)
        {
            var key = address.ToString();
            var buffer = queueClients.GetOrAdd(key, s =>
            {
                var b = new CircularBuffer<QueueClientEntry>(numberOfQueueClientsPerAddress);
                for (var i = 0; i < numberOfQueueClientsPerAddress; i++)
                {
                    var factory = messagingFactories.Get(address);
                    b.Put(new QueueClientEntry
                    {
                        Client = queueClientCreator.Create(address.Queue, factory)
                    });
                }
                return b;
            });

            var entry = buffer.Get();

            if (entry.Client.IsClosed)
            {
                lock (entry.mutex)
                {
                    if (entry.Client.IsClosed)
                    {
                        var factory = messagingFactories.Get(address);
                        entry.Client = queueClientCreator.Create(address.Queue, factory);
                    }
                }
            }

            return entry.Client;

        }
开发者ID:danielmarbach,项目名称:NServiceBus.AzureServiceBus,代码行数:34,代码来源:ManageQueueClientsLifeCycle.cs

示例4: Get

        public MessagingFactory Get(Address address)
        {
            var key = address.ToString();
            var buffer = MessagingFactories.GetOrAdd(key, s => {
                var b = new CircularBuffer<FactoryEntry>(numberOfFactoriesPerAddress);
                for(var i = 0; i < numberOfFactoriesPerAddress; i++) 
                    b.Put(new FactoryEntry { Factory = createMessagingFactories.Create(address) });
                return b;
            });

            var entry = buffer.Get();

            if (entry.Factory.IsClosed)
            {
                lock (entry.mutex)
                {
                    if (entry.Factory.IsClosed)
                    {
                        entry.Factory = createMessagingFactories.Create(address);
                    }
                }
            }

            return entry.Factory;

        }
开发者ID:danielmarbach,项目名称:NServiceBus.AzureServiceBus,代码行数:26,代码来源:ManageMessagingFactoriesLifeCycle.cs

示例5: Unsubscribe

        public virtual void Unsubscribe(Address address, IEnumerable<MessageType> messageTypes)
        {
            using (var transaction = new TransactionScope(TransactionScopeOption.Suppress))
            {
                using (var session = subscriptionStorageSessionProvider.OpenSession())
                {
                    using (var tx = session.BeginTransaction(IsolationLevel.ReadCommitted))
                    {
                        var subscriptions = session.QueryOver<Subscription>()
                            .Where(
                                s => s.TypeName.IsIn(messageTypes.Select(mt => mt.TypeName).ToList()) &&
                                     s.SubscriberEndpoint == address.ToString())
                            .List();

                        foreach (var subscription in subscriptions.Where(s => messageTypes.Contains(new MessageType(s.TypeName, s.Version))))
                        {
                            session.Delete(subscription);
                        }

                        tx.Commit();
                        transaction.Complete();
                    }
                }
            }
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:25,代码来源:SubscriptionPersister.cs

示例6: Main

 /* Also illustrates some String methods.
 */
 public static void Main()
 {
     Name aName = new Name("Henry", "Johnson");
     Address anAddress =
     new Address("1512 Harbor Blvd.", "Long Beach",
                         "CA", "99919");
     Console.Write("Enter an id string: ");
     String anId = Console.ReadLine();
     Person aPerson = new Person(anId,aName,anAddress);
     Console.WriteLine("Our person is ");
     Console.WriteLine(aPerson);
     Console.WriteLine("   with id {0}", aPerson.GetId());
     Console.WriteLine
        ("\n And now some tests using string methods");
     String address = anAddress.ToString();
     int i = address.IndexOf("Harbor");
     Console.WriteLine
        ("The index of Harbor in address is {0}", i);
     String z1 = "99919";
     int lenth = address.Length;
     Console.WriteLine("The length of address is {0}", l);
     String z2 = address.Substring(lenth-5,5);
     bool same = z2.Equals(z1);
     Console.WriteLine
         ("These two zip codes are the same? {0}", same);
     int less = z1.CompareTo("Harbor");
     Console.WriteLine("Compare returns {0}", less);
     String hat = "   hat   ";
     Console.WriteLine(hat+"rack");
     Console.WriteLine(hat.Trim() + "rack");
 }
开发者ID:JnS-Software-LLC,项目名称:CSC153,代码行数:33,代码来源:TestPerson.cs

示例7: using

        void ISubscriptionStorage.Subscribe(Address address, IEnumerable<MessageType> messageTypes)
        {
            using (var context = new SubscriptionServiceContext(client))
            {
                foreach (var messageType in messageTypes)
                {
                    try
                    {
                        var subscription = new Subscription
                        {
                            RowKey = EncodeTo64(address.ToString()),
                            PartitionKey = messageType.ToString()
                        };

                        context.AddObject(SubscriptionServiceContext.SubscriptionTableName, subscription);
                        context.SaveChangesWithRetries();
                    }
                    catch (StorageException ex)
                    {
                        if (ex.RequestInformation.HttpStatusCode != 409) throw;
                    }
                   
                }
            }
        }
开发者ID:jberke,项目名称:NServiceBus.Azure,代码行数:25,代码来源:AzureSubscriptionStorage.cs

示例8: Subscribe

        public virtual void Subscribe(Address address, IEnumerable<MessageType> messageTypes)
        {
            using (var transaction = new TransactionScope(TransactionScopeOption.Suppress))
            {
                using (var session = subscriptionStorageSessionProvider.OpenSession())
                {
                    using (var tx = session.BeginTransaction(IsolationLevel.ReadCommitted))
                    {
                        foreach (var messageType in messageTypes)
                        {
                            session.SaveOrUpdate(new Subscription
                            {
                                SubscriberEndpoint = address.ToString(),
                                MessageType = messageType.TypeName + "," + messageType.Version,
                                Version = messageType.Version.ToString(),
                                TypeName = messageType.TypeName
                            });
                        }

                        tx.Commit();
                        transaction.Complete();
                    }
                }
            }
        }
开发者ID:james-wu,项目名称:NServiceBus.NHibernate,代码行数:25,代码来源:SubscriptionPersister.cs

示例9: Subscribe

        public void Subscribe(Address client, params Type[] messageTypes)
        {
            if (messageTypes == null || messageTypes.Length == 0)
            {
                return;
            }

            using (var scope = new TransactionScope(TransactionScopeOption.Suppress))
            using (var connection = new SqlConnection(connectionString))
            {
                connection.Open();

                foreach (var messageType in messageTypes)
                {
                    Logger.Debug("Subscribing to {0}", messageType.FullName);

                    SqlCommand command = new SqlCommand(SqlCommands.Subscribe, connection);
                    command.Parameters.Add(new SqlParameter("SubscriberEndpoint", client.ToString()));
                    command.Parameters.Add(new SqlParameter("MessageType", messageType.FullName));
                    command.ExecuteNonQuery();
                }

                scope.Complete();
            }
        }
开发者ID:AdrianFreemantle,项目名称:Hermes,代码行数:25,代码来源:SqlSubscriptionStorage.cs

示例10: using

        void ISendMessages.Send(TransportMessage message, Address address)
        {
            var queuePath = MsmqUtilities.GetFullPath(address);

            using (var q = new MessageQueue(queuePath, QueueAccessMode.Send))
            {
                var toSend = MsmqUtilities.Convert(message);

                toSend.UseDeadLetterQueue = UseDeadLetterQueue;
                toSend.UseJournalQueue = UseJournalQueue;

                if (message.ReplyToAddress != null)
                    toSend.ResponseQueue = new MessageQueue(MsmqUtilities.GetReturnAddress(message.ReplyToAddress.ToString(), address.ToString()));

                try
                {
                    q.Send(toSend, GetTransactionTypeForSend());
                }
                catch (MessageQueueException ex)
                {
                    if (ex.MessageQueueErrorCode == MessageQueueErrorCode.QueueNotFound)
                        throw new QueueNotFoundException { Queue = address };

                    throw;
                }

                message.Id = toSend.Id;
            }
        }
开发者ID:rhinof,项目名称:NServiceBus,代码行数:29,代码来源:MsmqMessageSender.cs

示例11: Add

        /// <summary>
        /// Adds a message to the subscription store.
        /// </summary>
        public void Add(Address subscriber, MessageType messageType)
        {
            var toSend = new Message {Formatter = q.Formatter, Recoverable = true, Label = subscriber.ToString(), Body = messageType.TypeName +  ", Version=" + messageType.Version};

            q.Send(toSend, GetTransactionType());

            AddToLookup(subscriber, messageType, toSend.Id);
        }
开发者ID:petarvucetin,项目名称:NServiceBus,代码行数:11,代码来源:MsmqSubscriptionStorage.cs

示例12: Add

        /// <summary>
        /// Adds a message to the subscription store.
        /// </summary>
        public void Add(Address subscriber, string typeName)
        {
            var toSend = new Message {Formatter = q.Formatter, Recoverable = true, Label = subscriber.ToString(), Body = typeName};

            q.Send(toSend, GetTransactionType());

            AddToLookup(subscriber, typeName, toSend.Id);
        }
开发者ID:rsummer,项目名称:NServiceBus,代码行数:11,代码来源:MsmqSubscriptionStorage.cs

示例13: AddressInSubjectAltName

    ///<summary>Verify the edge by comparing the address in the certificate to
    ///the one provided in the overlay.</summary>
    public static bool AddressInSubjectAltName(Node node, Edge e, Address addr) {
      SecureEdge se = e as SecureEdge;
      if(se == null) {
        throw new Exception("Invalid edge type!");
      }

      return se.SA.Verify(addr.ToString());
    }
开发者ID:pstjuste,项目名称:brunet,代码行数:10,代码来源:EdgeVerification.cs

示例14: AddDiagnostic

 public void AddDiagnostic(Address addr, Diagnostic d)
 {
     Console.Write(d.GetType().Name);
     Console.Write(" - ");
     Console.WriteLine(addr.ToString());
     Console.Write(": ");
     Console.WriteLine(d.Message);
 }
开发者ID:feelworld,项目名称:reko,代码行数:8,代码来源:OperandRewriterTests.cs

示例15: TestScriptPubKey

 public void TestScriptPubKey()
 {
     // Check we can extract the to address
     var pubkeyBytes = Hex.Decode(_pubkeyProg);
     var pubkey = new Script(_params, pubkeyBytes, 0, pubkeyBytes.Length);
     var toAddr = new Address(_params, pubkey.PubKeyHash);
     Assert.AreEqual("mkFQohBpy2HDXrCwyMrYL5RtfrmeiuuPY2", toAddr.ToString());
 }
开发者ID:jarell-lloyd,项目名称:BitcoinSharp,代码行数:8,代码来源:ScriptTest.cs


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