public static void Main( )
    {
// <Snippet1>
        ServiceDescription myServiceDescription = new ServiceDescription();

        myServiceDescription =
            ServiceDescription.Read("ServiceDescription_Imports_Input_CS.wsdl");
        ImportCollection myImportCollection = myServiceDescription.Imports;

        // Create an Import.
        Import myImport = new Import();

        myImport.Namespace = myServiceDescription.TargetNamespace;

        // Set the location for the Import.
        myImport.Location = "http://www.contoso.com/";
        myImportCollection.Add(myImport);
        myServiceDescription.Write("ServiceDescription_Imports_Output_CS.wsdl");
        myImportCollection.Clear();
        myServiceDescription =
            ServiceDescription.Read("ServiceDescription_Imports_Output_CS.wsdl");
        myImportCollection = myServiceDescription.Imports;
        Console.WriteLine(
            "The Import elements added to the ImportCollection are: ");
        for (int i = 0; i < myImportCollection.Count; i++)
        {
            Console.WriteLine((i + 1) + ". " + myImportCollection[i].Location);
        }
// </Snippet1>
    }
Пример #2
0
        private void ExpandImport(Import import)
        {
            ImportCollection imports = _node.GetAncestor <Module>().Imports;

            if (imports.Contains(import.Matches))
            {
                return;
            }

            imports.Add(import);
            BindImport(import);
        }
Пример #3
0
        private ImportCollection LoadImports(XmlNode node)
        {
            ImportCollection imports = new ImportCollection();

            foreach (XmlNode xn in node.ChildNodes)
            {
                if ("#comment" == xn.Name)
                {
                    continue;
                }

                Import import = LoadImport(xn);
                imports.Add(import.Id, import);
            }

            return(imports);
        }