src/Foundation/ServiceModel/Gimela.ServiceModel.ManagedDiscovery/DiscoveryProxy/ServiceDiscoveryProxy.cs
/// <summary>
/// Override this method to handle a find operation.
/// </summary>
/// <param name="findRequestContext">The find request context that describes the service to discover.</param>
/// <param name="callback">The callback delegate to call when the operation is completed.</param>
/// <param name="state">The user-defined state data.</param>
/// <returns>
/// A reference to the pending asynchronous operation.
/// </returns>
Override this method to handle a find operation.
Override this method to handle a find operation .
protected override IAsyncResult OnBeginFind(FindRequestContext findRequestContext, AsyncCallback callback, object state)
    {
      if (findRequestContext == null)
      {
        throw new ArgumentNullException("findRequestContext");
      }
      Console.WriteLine("Find request for contract {0}", findRequestContext.Criteria.ContractTypeNames.FirstOrDefault());
      var query = from service in cache
                  where findRequestContext.Criteria.IsMatch(service)
                  select service;
      var matchingEndpoints = new Collection<EndpointDiscoveryMetadata>();
      foreach (EndpointDiscoveryMetadata metadata in query)
      {
        matchingEndpoints.Add(metadata);
        findRequestContext.AddMatchingEndpoint(metadata);
      }
      return new FindAsyncResult(matchingEndpoints, callback, state);
    }
protected override IAsyncResult OnBeginFind ( FindRequestContext findRequestContext , AsyncCallback callback , object state ) { if ( findRequestContext == null ) { throw new ArgumentNullException ( " " ) ; } Console . WriteLine ( " " , findRequestContext . Criteria . ContractTypeNames . FirstOrDefault ( ) ) ; var query = from service in cache where findRequestContext . Criteria . IsMatch ( service ) select service ; var matchingEndpoints = new Collection < EndpointDiscoveryMetadata > ( ) ; foreach ( EndpointDiscoveryMetadata metadata in query ) { matchingEndpoints . Add ( metadata ) ; findRequestContext . AddMatchingEndpoint ( metadata ) ; } return new FindAsyncResult ( matchingEndpoints , callback , state ) ; }
Override this method to handle a find operation.
Override this method to handle a find operation .
// query to find the matching endpoints // collection to contain the results of the query // execute the query and add the matching endpoints
A reference to the pending asynchronous operation.
A reference to the pending asynchronous operation .
findRequestContext
FindRequestContext
The find request context that describes the service to discover.
The find request context that describes the service to discover .
callback
AsyncCallback
The callback delegate to call when the operation is completed.
The callback delegate to call when the operation is completed .
state
object
The user-defined state data.
The user - defined state data .