本文整理汇总了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);
}
}
示例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
});
}
}
示例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;
}
示例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();
}
}
}
}
示例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");
}
示例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;
}
}
}
}
示例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();
}
}
}
}
示例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();
}
}
示例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;
}
}
示例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);
}
示例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);
}
示例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());
}
示例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);
}
示例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());
}