void Match(FindRequestContext findRequestContext)
        {
            FindCriteria criteria = findRequestContext.Criteria;

            if (!ScopeCompiler.IsSupportedMatchingRule(criteria.ScopeMatchBy))
            {
                return;
            }

            CompiledScopeCriteria[] compiledScopeCriterias = ScopeCompiler.CompileMatchCriteria(
                criteria.InternalScopes,
                criteria.ScopeMatchBy);

            int matchingEndpointCount = 0;

            for (int i = 0; i < this.publishedEndpoints.Count; i++)
            {
                if (criteria.IsMatch(this.publishedEndpoints[i], compiledScopeCriterias))
                {
                    findRequestContext.AddMatchingEndpoint(this.publishedEndpoints[i]);
                    matchingEndpointCount++;

                    if (matchingEndpointCount == criteria.MaxResults)
                    {
                        break;
                    }
                }
            }
        }
        public bool IsMatch(EndpointDiscoveryMetadata endpointDiscoveryMetadata)
        {
            if (endpointDiscoveryMetadata == null)
            {
                throw FxTrace.Exception.ArgumentNull("endpointDiscoveryMetadata");
            }

            return(IsMatch(endpointDiscoveryMetadata, ScopeCompiler.CompileMatchCriteria(this.scopes, this.scopeMatchBy)));
        }