本文整理汇总了C#中System.ServiceModel.Discovery.EndpointDiscoveryMetadata类的典型用法代码示例。如果您正苦于以下问题:C# EndpointDiscoveryMetadata类的具体用法?C# EndpointDiscoveryMetadata怎么用?C# EndpointDiscoveryMetadata使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EndpointDiscoveryMetadata类属于System.ServiceModel.Discovery命名空间,在下文中一共展示了EndpointDiscoveryMetadata类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveService
private void RemoveService(ServiceHost serviceHost, EndpointDiscoveryMetadata endpoint)
{
if (IsSelfDiscovery(serviceHost, endpoint) == false)
{
serviceCatalog.RemoveService(endpoint);
}
}
示例2: RemoveEndpointMetadata
public override void RemoveEndpointMetadata(EndpointDiscoveryMetadata metadata)
{
var uri = metadata.Address.Uri.AbsoluteUri;
var addressJson = JsonConvert.SerializeObject(metadata.Address);
var contractTypeNames = metadata.GetContractTypeNames();
var bindingTypeName = metadata.GetBindingTypeName();
using (var conn = _connectionCreator.Invoke(_connectionString))
{
var cmd = conn.CreateCommand();
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "UnRegisterServiceEndpointMetadata";
cmd.AddParameter("uri", uri)
.AddParameter("contractType", null)
.AddParameter("address", addressJson)
.AddParameter("bindingType", bindingTypeName);
conn.Open();
cmd.Transaction = conn.BeginTransaction();
foreach (var contractTypeName in contractTypeNames)
{
cmd.GetParameter("contractType").Value = contractTypeName;
cmd.ExecuteNonQuery();
}
cmd.Transaction.Commit();
}
}
示例3: AnnouncementEventArgs
internal AnnouncementEventArgs(
DiscoveryMessageSequence messageSequence,
EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
this.MessageSequence = messageSequence;
this.EndpointDiscoveryMetadata = endpointDiscoveryMetadata;
}
示例4: FindProgressChangedEventArgs
internal FindProgressChangedEventArgs(int progressPercentage, object userState,
EndpointDiscoveryMetadata endpointDiscoveryMetadata, DiscoveryMessageSequence messageSequence)
: base(progressPercentage, userState)
{
this.endpointDiscoveryMetadata = endpointDiscoveryMetadata;
this.messageSequence = messageSequence;
}
示例5: AnnonceOnlineOfflineNoBinding
public void AnnonceOnlineOfflineNoBinding ()
{
var ac = new AnnouncementClient (new AnnouncementEndpoint () { Address = new EndpointAddress ("http://localhost:37564")});
var edm = new EndpointDiscoveryMetadata ();
ac.AnnounceOnline (edm);
// attempt to close the client causes another CommunicationObjectFaultedException - looks like it fails to allow Close() at faulted state unlike other objects.
}
示例6: RegisterEndpoint
public virtual bool RegisterEndpoint(EndpointDiscoveryMetadata endpoint)
{
var registered = false;
if (AcceptEndpoint(endpoint))
{
using (var locker = @lock.ForReadingUpgradeable())
{
policies.ForEach(policy => registered = registered | policy.RegisterTarget(endpoint));
locker.Upgrade();
if (registered == false)
{
var newPolicies = policyFactory.CreatePolicies(endpoint);
Array.ForEach(newPolicies, newPolicy =>
{
registered = registered | newPolicy.RegisterTarget(endpoint);
policies.Add(newPolicy);
});
}
if (registered)
endpoints[endpoint.Address] = endpoint;
}
}
return registered;
}
示例7: OnBeginOfflineAnnouncement
protected override IAsyncResult OnBeginOfflineAnnouncement(
DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata,
AsyncCallback callback, object state)
{
implementation.RemoveEndpoint(endpointDiscoveryMetadata);
return new SynchronousResult(callback, state);
}
示例8: RegisterService
private void RegisterService(ServiceHost serviceHost, EndpointDiscoveryMetadata endpoint)
{
if (FilterService(serviceHost, endpoint) == false)
{
serviceCatalog.RegisterService(endpoint);
}
}
示例9: OnBeginOfflineAnnouncement
protected override IAsyncResult OnBeginOfflineAnnouncement(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
{
try
{
if (endpointDiscoveryMetadata == null)
{
throw new ArgumentNullException("endpointDiscoveryMetadata");
}
// We care only about ISimpleChatService services
FindCriteria criteria = new FindCriteria(typeof(ISimpleChatService));
if (criteria.IsMatch(endpointDiscoveryMetadata))
{
endpointDiscoveryMetadata.WriteLine("Removing");
Cache.Remove(endpointDiscoveryMetadata.Address.Uri);
}
}
catch (KeyNotFoundException)
{
// No problem if it does not exist in the cache
}
return new CompletedAsyncResult(callback, state);
}
示例10: PopulateUserList
private void PopulateUserList(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
if (!this.EndpointIsSelf(endpointDiscoveryMetadata.Address.Uri))
{
this.AddUser(new PeerUser(endpointDiscoveryMetadata.Address));
}
}
示例11: OnBeginOfflineAnnouncement
//OfflineAnnouncement
protected override IAsyncResult OnBeginOfflineAnnouncement(DiscoveryMessageSequence messageSequence, EndpointDiscoveryMetadata endpointDiscoveryMetadata, AsyncCallback callback, object state)
{
if (this.Endpoints.ContainsKey(endpointDiscoveryMetadata.Address))
{
this.Endpoints.Remove(endpointDiscoveryMetadata.Address);
}
return new DiscoveryAsyncResult(callback, state);
}
示例12: AddOnlineService
// The following are helper methods required by the Proxy implementation
void AddOnlineService(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
lock (this.onlineServices)
{
this.onlineServices[endpointDiscoveryMetadata.Address] = endpointDiscoveryMetadata;
}
}
示例13: RegisterService
public virtual void RegisterService(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
if (AcceptService(endpointDiscoveryMetadata))
{
services.AddOrUpdate(endpointDiscoveryMetadata.Address, endpointDiscoveryMetadata,
(address, existing) => endpointDiscoveryMetadata);
}
}
示例14: RegisterEndpoint
public virtual void RegisterEndpoint(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
{
if (AcceptEndpoint(endpointDiscoveryMetadata))
{
endpoints.AddOrUpdate(endpointDiscoveryMetadata.Address, endpointDiscoveryMetadata,
(address, existing) => endpointDiscoveryMetadata);
}
}
示例15: OnBeginOnlineAnnouncement
// OnBeginOnlineAnnouncement method is called when a Hello message is received by the Proxy
protected override IAsyncResult OnBeginOnlineAnnouncement(DiscoveryMessageSequence messageSequence,
EndpointDiscoveryMetadata endpointDiscoveryMetadata,
AsyncCallback callback, object state)
{
_logger.Log("OnBeginOnlineAnnouncement()", LogLevel.Debug);
_provider.Add(endpointDiscoveryMetadata);
return new OnOnlineAnnouncementAsyncResult(callback, state);
}