本文整理汇总了C#中IScope.GetConnections方法的典型用法代码示例。如果您正苦于以下问题:C# IScope.GetConnections方法的具体用法?C# IScope.GetConnections怎么用?C# IScope.GetConnections使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IScope
的用法示例。
在下文中一共展示了IScope.GetConnections方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InvokeClients
/// <summary>
/// Invoke clients with parameters and callback.
/// </summary>
/// <param name="method">Method name.</param>
/// <param name="arguments">Invocation parameters passed to the method.</param>
/// <param name="callback">Callback used to handle return values.</param>
/// <param name="ignoreSelf">Current client shoud be ignored.</param>
/// <param name="targetScope">Invoke clients subscribed to the specified Scope.</param>
protected void InvokeClients(string method, object[] arguments, IPendingServiceCallback callback, bool ignoreSelf, IScope targetScope)
{
try
{
if (log.IsDebugEnabled)
log.Debug(string.Format("Invoke clients: {0}", method));
IServiceCapableConnection connection = FluorineFx.Context.FluorineContext.Current.Connection as IServiceCapableConnection;
IEnumerator collections = targetScope.GetConnections();
while (collections.MoveNext())
{
IConnection connectionTmp = collections.Current as IConnection;
if (!connectionTmp.Scope.Name.Equals(targetScope.Name))
continue;
if ((connectionTmp is IServiceCapableConnection) && (!ignoreSelf || connectionTmp != connection))
(connectionTmp as IServiceCapableConnection).Invoke(method, arguments, callback);
}
}
catch (Exception ex)
{
if (log.IsErrorEnabled)
log.Error("InvokeClients failed", ex);
throw;
}
finally
{
if (log.IsDebugEnabled)
log.Debug(string.Format("Finished invoking clients ({0})", method));
}
}