Exemplo n.º 1
0
 public IEnumerable <ResourceType> GetVisibleTypes(DataServiceOperationContext operationContext)
 {
     if (this.Configuration.AccessEnabledForAllResourceTypes)
     {
         foreach (ResourceType iteratorVariable0 in this.Types)
         {
             yield return(iteratorVariable0);
         }
     }
     else
     {
         HashSet <ResourceType>     visitedTypes = new HashSet <ResourceType>(EqualityComparer <ResourceType> .Default);
         IEnumerable <ResourceType> first        = new ResourceType[0];
         foreach (ResourceSetWrapper wrapper in this.GetResourceSets())
         {
             first = first.Concat <ResourceType>(this.GetReachableTypesFromSet(wrapper, visitedTypes));
         }
         foreach (OperationWrapper wrapper2 in this.GetVisibleOperations(operationContext))
         {
             first = first.Concat <ResourceType>(this.GetReachableComplexTypesFromOperation(wrapper2, visitedTypes));
         }
         foreach (string str in this.Configuration.GetAccessEnabledResourceTypes())
         {
             ResourceType resourceType = this.TryResolveResourceType(str);
             if (resourceType == null)
             {
                 throw new InvalidOperationException(System.Data.Services.Strings.MetadataSerializer_AccessEnabledTypeNoLongerExists(str));
             }
             first = first.Concat <ResourceType>(this.GetResourceTypeAndReachableComplexTypes(resourceType, visitedTypes));
         }
         foreach (ResourceType iteratorVariable3 in first)
         {
             yield return(iteratorVariable3);
         }
     }
 }