示例#1
0
        private List <PSSchemaBuilder.EntityDataForSchemaBuilding> CreateEntityDataForSchemaBuilding(Microsoft.Management.Odata.Schema.Schema logicalSchema, HashSet <string> initialSessionCommands)
        {
            IEnumerable <PSSchemaBuilder.EntityDataForSchemaBuilding> entityDataForSchemaBuildings  = null;
            List <PSSchemaBuilder.EntityDataForSchemaBuilding>        entityDataForSchemaBuildings1 = new List <PSSchemaBuilder.EntityDataForSchemaBuilding>();

            foreach (string key in logicalSchema.EntityMetadataDictionary.Keys)
            {
                if (logicalSchema.EntityMetadataDictionary[key].MgmtSystem != ManagementSystemType.PowerShell)
                {
                    continue;
                }
                PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding = new PSSchemaBuilder.EntityDataForSchemaBuilding(key);
                PSEntityMetadata item = (PSEntityMetadata)logicalSchema.EntityMetadataDictionary[key];
                entityDataForSchemaBuilding.Commands             = this.FindSupportedCommands(item, initialSessionCommands);
                entityDataForSchemaBuilding.ReferenceSetCommands = this.FindSupportedReferenceCommands(item, initialSessionCommands);
                entityDataForSchemaBuildings1.Add(entityDataForSchemaBuilding);
            }
            foreach (PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding1 in entityDataForSchemaBuildings1)
            {
                if (!entityDataForSchemaBuilding1.Commands.Contains(CommandType.Read))
                {
                    continue;
                }
                entityDataForSchemaBuilding1.IncludeEntitySet = true;
                entityDataForSchemaBuilding1.IncludeInSchema  = true;
                new HashSet <ResourceType>();
                ResourceType           resourceType = logicalSchema.ResourceTypes[entityDataForSchemaBuilding1.EntityName];
                HashSet <ResourceType> family       = resourceType.GetFamily();
                List <PSSchemaBuilder.EntityDataForSchemaBuilding> entityDataForSchemaBuildings2 = entityDataForSchemaBuildings1;
                HashSet <ResourceType> resourceTypes = family;
                Func <PSSchemaBuilder.EntityDataForSchemaBuilding, string> func = (PSSchemaBuilder.EntityDataForSchemaBuilding entityStat) => entityStat.EntityName;
                Func <ResourceType, string> func1 = (ResourceType res) => res.FullName;
                entityDataForSchemaBuildings = entityDataForSchemaBuildings2.Join <PSSchemaBuilder.EntityDataForSchemaBuilding, ResourceType, string, PSSchemaBuilder.EntityDataForSchemaBuilding>(resourceTypes, func, func1, (PSSchemaBuilder.EntityDataForSchemaBuilding entityStat, ResourceType res) => entityStat);
                IEnumerator <PSSchemaBuilder.EntityDataForSchemaBuilding> enumerator = entityDataForSchemaBuildings.GetEnumerator();
                using (enumerator)
                {
                    while (enumerator.MoveNext())
                    {
                        PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding2 = entityDataForSchemaBuilding1;
                        entityDataForSchemaBuilding2.IncludeInSchema = true;
                    }
                }
            }
            return(entityDataForSchemaBuildings1);
        }
示例#2
0
		private List<PSSchemaBuilder.EntityDataForSchemaBuilding> CreateEntityDataForSchemaBuilding(Microsoft.Management.Odata.Schema.Schema logicalSchema, HashSet<string> initialSessionCommands)
		{
			IEnumerable<PSSchemaBuilder.EntityDataForSchemaBuilding> entityDataForSchemaBuildings = null;
			List<PSSchemaBuilder.EntityDataForSchemaBuilding> entityDataForSchemaBuildings1 = new List<PSSchemaBuilder.EntityDataForSchemaBuilding>();
			foreach (string key in logicalSchema.EntityMetadataDictionary.Keys)
			{
				if (logicalSchema.EntityMetadataDictionary[key].MgmtSystem != ManagementSystemType.PowerShell)
				{
					continue;
				}
				PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding = new PSSchemaBuilder.EntityDataForSchemaBuilding(key);
				PSEntityMetadata item = (PSEntityMetadata)logicalSchema.EntityMetadataDictionary[key];
				entityDataForSchemaBuilding.Commands = this.FindSupportedCommands(item, initialSessionCommands);
				entityDataForSchemaBuilding.ReferenceSetCommands = this.FindSupportedReferenceCommands(item, initialSessionCommands);
				entityDataForSchemaBuildings1.Add(entityDataForSchemaBuilding);
			}
			foreach (PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding1 in entityDataForSchemaBuildings1)
			{
				if (!entityDataForSchemaBuilding1.Commands.Contains(CommandType.Read))
				{
					continue;
				}
				entityDataForSchemaBuilding1.IncludeEntitySet = true;
				entityDataForSchemaBuilding1.IncludeInSchema = true;
				new HashSet<ResourceType>();
				ResourceType resourceType = logicalSchema.ResourceTypes[entityDataForSchemaBuilding1.EntityName];
				HashSet<ResourceType> family = resourceType.GetFamily();
				List<PSSchemaBuilder.EntityDataForSchemaBuilding> entityDataForSchemaBuildings2 = entityDataForSchemaBuildings1;
				HashSet<ResourceType> resourceTypes = family;
				Func<PSSchemaBuilder.EntityDataForSchemaBuilding, string> func = (PSSchemaBuilder.EntityDataForSchemaBuilding entityStat) => entityStat.EntityName;
				Func<ResourceType, string> func1 = (ResourceType res) => res.FullName;
				entityDataForSchemaBuildings = entityDataForSchemaBuildings2.Join<PSSchemaBuilder.EntityDataForSchemaBuilding, ResourceType, string, PSSchemaBuilder.EntityDataForSchemaBuilding>(resourceTypes, func, func1, (PSSchemaBuilder.EntityDataForSchemaBuilding entityStat, ResourceType res) => entityStat);
				IEnumerator<PSSchemaBuilder.EntityDataForSchemaBuilding> enumerator = entityDataForSchemaBuildings.GetEnumerator();
				using (enumerator)
				{
					while (enumerator.MoveNext())
					{
						PSSchemaBuilder.EntityDataForSchemaBuilding entityDataForSchemaBuilding2 = entityDataForSchemaBuilding1;
						entityDataForSchemaBuilding2.IncludeInSchema = true;
					}
				}
			}
			return entityDataForSchemaBuildings1;
		}