DiscoveryExceptionDictionary Klass

Definition

Samlar in undantag som inträffade under xml-webbtjänstidentifiering. Det går inte att ärva den här klassen.

public ref class DiscoveryExceptionDictionary sealed : System::Collections::DictionaryBase
public sealed class DiscoveryExceptionDictionary : System.Collections.DictionaryBase
type DiscoveryExceptionDictionary = class
    inherit DictionaryBase
Public NotInheritable Class DiscoveryExceptionDictionary
Inherits DictionaryBase
Arv
DiscoveryExceptionDictionary

Exempel

#using <System.Xml.dll>
#using <System.Web.Services.dll>
#using <System.dll>

using namespace System;
using namespace System::Web::Services::Discovery;
using namespace System::Xml;
using namespace System::Collections;
using namespace System::Runtime::Remoting;
using namespace System::Net;

int main()
{
   String^ myDiscoFile = "http://localhost/MathService_cs.disco";
   String^ myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
   DiscoveryClientProtocol^ myDiscoveryClientProtocol1 = gcnew DiscoveryClientProtocol;
   DiscoveryDocument^ myDiscoveryDocument = myDiscoveryClientProtocol1->Discover( myDiscoFile );
   IEnumerator^ myEnumerator = myDiscoveryDocument->References->GetEnumerator();
   while ( myEnumerator->MoveNext() )
   {
      ContractReference^ myContractReference = dynamic_cast<ContractReference^>(myEnumerator->Current);
      DiscoveryClientProtocol^ myDiscoveryClientProtocol2 = myContractReference->ClientProtocol;
      myDiscoveryClientProtocol2->ResolveAll();
      
      DiscoveryExceptionDictionary^ myExceptionDictionary = myDiscoveryClientProtocol2->Errors;
      if ( myExceptionDictionary->Contains( myUrlKey ))
      {
         Console::WriteLine( "'myExceptionDictionary' contains a discovery exception for the key '{0}'", myUrlKey );
      }
      else
      {
         Console::WriteLine( "'myExceptionDictionary' does not contain a discovery exception for the key '{0}'", myUrlKey );
      }
      if ( myExceptionDictionary->Contains( myUrlKey ) )
      {
         Console::WriteLine( "System generated exceptions." );
         
         Exception^ myException = myExceptionDictionary[ myUrlKey ];
         Console::WriteLine( " Source : {0}", myException->Source );
         Console::WriteLine( " Exception : {0}", myException->Message );

         Console::WriteLine();
         
         // Remove the discovery exception.for the key 'myUrlKey'.
         myExceptionDictionary->Remove( myUrlKey );

         DiscoveryExceptionDictionary^ myNewExceptionDictionary = gcnew DiscoveryExceptionDictionary;
         
         // Add an exception with the custom error message.
         Exception^ myNewException = gcnew Exception( "The requested service is not available." );
         myNewExceptionDictionary->Add( myUrlKey, myNewException );
         myExceptionDictionary = myNewExceptionDictionary;

         Console::WriteLine( "Added exceptions." );
         
         array<Object^>^myArray = gcnew array<Object^>(myExceptionDictionary->Count);
         myExceptionDictionary->Keys->CopyTo( (Array^)myArray, 0 );
         Console::WriteLine( " Keys are :" );

         for each(Object^ myObj in myArray)
         {
            Console::WriteLine(" " + myObj->ToString());
         }

         Console::WriteLine();
         
         array<Object^>^myCollectionArray = gcnew array<Object^>(myExceptionDictionary->Count);
         myExceptionDictionary->Values->CopyTo( (Array^)myCollectionArray, 0 );
         Console::WriteLine( " Values are :" );
         for each(Object^ myObj in myCollectionArray)
         {
            Console::WriteLine(" " + myObj->ToString());
         }
      }
   }
}
using System;
using System.Web.Services.Discovery;
using System.Xml;
using System.Collections;
using System.Runtime.Remoting;
using System.Net;

public class MySample
{
   static void Main()
   {
      string myDiscoFile = "http://localhost/MathService_cs.disco";
      string myUrlKey = "http://localhost/MathService_cs.asmx?wsdl";
      DiscoveryClientProtocol myDiscoveryClientProtocol1 =
                                            new DiscoveryClientProtocol();
      DiscoveryDocument myDiscoveryDocument =
                         myDiscoveryClientProtocol1.Discover(myDiscoFile);
      IEnumerator myEnumerator =
                           myDiscoveryDocument.References.GetEnumerator();
      while ( myEnumerator.MoveNext() )
      {
         ContractReference myContractReference =
                                  (ContractReference)myEnumerator.Current;
         DiscoveryClientProtocol myDiscoveryClientProtocol2 =
                                       myContractReference.ClientProtocol;
         myDiscoveryClientProtocol2.ResolveAll();
         DiscoveryExceptionDictionary myExceptionDictionary
                                      = myDiscoveryClientProtocol2.Errors;
         if ( myExceptionDictionary.Contains(myUrlKey))
         {
            Console.WriteLine("'myExceptionDictionary' contains " +
                      " a discovery exception for the key '" + myUrlKey + "'");
         }
         else
         {
            Console.WriteLine("'myExceptionDictionary' does not contain" +
                      " a discovery exception for the key '" + myUrlKey + "'");
         }
         if (myExceptionDictionary.Contains(myUrlKey))
         {
            Console.WriteLine("System generated exceptions.");

            Exception myException = myExceptionDictionary[myUrlKey];
            Console.WriteLine(" Source : " + myException.Source);
            Console.WriteLine(" Exception : " + myException.Message);

            Console.WriteLine();

            // Remove the discovery exception.for the key 'myUrlKey'.
            myExceptionDictionary.Remove(myUrlKey);

            DiscoveryExceptionDictionary myNewExceptionDictionary =
                                       new DiscoveryExceptionDictionary();
            // Add an exception with the custom error message.
            Exception myNewException =
                 new Exception("The requested service is not available.");
            myNewExceptionDictionary.Add(myUrlKey, myNewException);
            myExceptionDictionary = myNewExceptionDictionary;

            Console.WriteLine("Added exceptions.");

            object[] myArray = new object[myExceptionDictionary.Count];
            myExceptionDictionary.Keys.CopyTo((Array)myArray,0);
            Console.WriteLine(" Keys are :");
            foreach(object myObj in myArray)
            {
               Console.WriteLine(" " + myObj.ToString());
            }

            Console.WriteLine();

            object[] myCollectionArray = new object[myExceptionDictionary.Count];
            myExceptionDictionary.Values.CopyTo((Array)myCollectionArray,0);
            Console.WriteLine(" Values are :");
            foreach(object myObj in myCollectionArray)
            {
               Console.WriteLine(" " + myObj.ToString());
            }
         }
      }
   }
}
Imports System.Web.Services.Discovery
Imports System.Xml
Imports System.Collections
Imports System.Runtime.Remoting
Imports System.Net

Public Class MySample
   
   Shared Sub Main()
      Dim myDiscoFile As String = "http://localhost/MathService_vb.disco"
      Dim myUrlKey As String = "http://localhost/MathService_vb.asmx?wsdl"
      Dim myDiscoveryClientProtocol1 As New DiscoveryClientProtocol()
      Dim myDiscoveryDocument As DiscoveryDocument = myDiscoveryClientProtocol1.Discover(myDiscoFile)
      Dim myEnumerator As IEnumerator = myDiscoveryDocument.References.GetEnumerator()
      While myEnumerator.MoveNext()
         Dim myContractReference As ContractReference = CType(myEnumerator.Current, ContractReference)
         Dim myDiscoveryClientProtocol2 As DiscoveryClientProtocol = myContractReference.ClientProtocol
         myDiscoveryClientProtocol2.ResolveAll()
         Dim myExceptionDictionary As DiscoveryExceptionDictionary = myDiscoveryClientProtocol2.Errors
         If myExceptionDictionary.Contains(myUrlKey) = True Then
            Console.WriteLine("'myExceptionDictionary' contains " + _
                 "a discovery exception for the key '" + myUrlKey + "'")
         Else
            Console.WriteLine("'myExceptionDictionary' does not contain" + _
                 " a discovery exception for the key '" + myUrlKey + "'")
         End If
         If myExceptionDictionary.Contains(myUrlKey) = True Then
            Console.WriteLine("System generated exceptions.")
            
            Dim myException As Exception = myExceptionDictionary(myUrlKey)
            Console.WriteLine(" Source : " + myException.Source)
            Console.WriteLine(" Exception : " + myException.Message)
            Console.WriteLine()
            
            ' Remove the discovery exception.for the key 'myUrlKey'.
            myExceptionDictionary.Remove(myUrlKey)
            Dim myNewExceptionDictionary As New DiscoveryExceptionDictionary()
            ' Add an exception with the custom error message.
            Dim myNewException As New Exception("The requested service is not available.")
            myNewExceptionDictionary.Add(myUrlKey, myNewException)
            myExceptionDictionary = myNewExceptionDictionary
            Console.WriteLine("Added exceptions.")
            
            Dim myArray(myExceptionDictionary.Count -1 ) As Object
            myExceptionDictionary.Keys.CopyTo(CType(myArray, Array), 0)
            Console.WriteLine(" Keys are :")
            Dim myObj As Object
            For Each myObj In  myArray
               Console.WriteLine(" " + myObj.ToString())
            Next myObj
            Console.WriteLine()
            
            Dim myCollectionArray(myExceptionDictionary.Count -1 ) As Object
            myExceptionDictionary.Values.CopyTo(CType(myCollectionArray, Array), 0)
            Console.WriteLine(" Values are :")
            For Each myObj In  myCollectionArray
               Console.WriteLine(" " + myObj.ToString())
            Next myObj
         End If 
      End While
   End Sub
End Class

Kommentarer

Egenskapen Errors för är av DiscoveryClientProtocol typen DiscoveryExceptionDictionary.

Konstruktorer

Name Description
DiscoveryExceptionDictionary()

Initierar en ny instans av DiscoveryExceptionDictionary klassen.

Egenskaper

Name Description
Count

Hämtar antalet element som finns i instansen DictionaryBase .

(Ärvd från DictionaryBase)
Dictionary

Hämtar listan över element som finns i instansen DictionaryBase .

(Ärvd från DictionaryBase)
InnerHashtable

Hämtar listan över element som finns i instansen DictionaryBase .

(Ärvd från DictionaryBase)
Item[String]

Hämtar eller anger Exception det som inträffade när den angivna URL:en upptäcktes DiscoveryExceptionDictionaryfrån .

Keys

Hämtar ett ICollection objekt med alla nycklar i DiscoveryExceptionDictionary.

Values

Hämtar ett ICollection objekt som innehåller alla värden i DiscoveryExceptionDictionary.

Metoder

Name Description
Add(String, Exception)

Lägger till en Exception med en nyckel url för i DiscoveryExceptionDictionary.

Clear()

Rensar innehållet i instansen DictionaryBase .

(Ärvd från DictionaryBase)
Contains(String)

Avgör om innehåller DiscoveryExceptionDictionary en Exception med den angivna URL:en.

CopyTo(Array, Int32)

Kopierar elementen DictionaryBase till en endimensionell Array vid det angivna indexet.

(Ärvd från DictionaryBase)
Equals(Object)

Avgör om det angivna objektet är lika med det aktuella objektet.

(Ärvd från Object)
GetEnumerator()

Returnerar en IDictionaryEnumerator som itererar genom instansen DictionaryBase .

(Ärvd från DictionaryBase)
GetHashCode()

Fungerar som standard-hash-funktion.

(Ärvd från Object)
GetType()

Hämtar den aktuella instansen Type .

(Ärvd från Object)
MemberwiseClone()

Skapar en ytlig kopia av den aktuella Object.

(Ärvd från Object)
OnClear()

Utför ytterligare anpassade processer innan innehållet i instansen rensas DictionaryBase .

(Ärvd från DictionaryBase)
OnClearComplete()

Utför ytterligare anpassade processer när innehållet i instansen har rensats DictionaryBase .

(Ärvd från DictionaryBase)
OnGet(Object, Object)

Hämtar elementet med den angivna nyckeln och värdet i instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnInsert(Object, Object)

Utför ytterligare anpassade processer innan du infogar ett nytt element i instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnInsertComplete(Object, Object)

Utför ytterligare anpassade processer när du har infogat ett nytt element i instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnRemove(Object, Object)

Utför ytterligare anpassade processer innan du tar bort ett element från instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnRemoveComplete(Object, Object)

Utför ytterligare anpassade processer när du har tagit bort ett element från instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnSet(Object, Object, Object)

Utför ytterligare anpassade processer innan du anger ett värde i instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnSetComplete(Object, Object, Object)

Utför ytterligare anpassade processer när du har angett ett värde i instansen DictionaryBase .

(Ärvd från DictionaryBase)
OnValidate(Object, Object)

Utför ytterligare anpassade processer när elementet verifieras med den angivna nyckeln och värdet.

(Ärvd från DictionaryBase)
Remove(String)

Tar bort en Exception med den angivna URL:en från DiscoveryExceptionDictionary.

ToString()

Returnerar en sträng som representerar det aktuella objektet.

(Ärvd från Object)

Explicita gränssnittsimplementeringar

Name Description
ICollection.IsSynchronized

Hämtar ett värde som anger om åtkomsten till ett DictionaryBase objekt synkroniseras (trådsäker).

(Ärvd från DictionaryBase)
ICollection.SyncRoot

Hämtar ett objekt som kan användas för att synkronisera åtkomst till ett DictionaryBase objekt.

(Ärvd från DictionaryBase)
IDictionary.Add(Object, Object)

Lägger till ett element med den angivna nyckeln och värdet i DictionaryBase.

(Ärvd från DictionaryBase)
IDictionary.Contains(Object)

Avgör om innehåller DictionaryBase en specifik nyckel.

(Ärvd från DictionaryBase)
IDictionary.IsFixedSize

Hämtar ett värde som anger om ett DictionaryBase objekt har en fast storlek.

(Ärvd från DictionaryBase)
IDictionary.IsReadOnly

Hämtar ett värde som anger om ett DictionaryBase objekt är skrivskyddat.

(Ärvd från DictionaryBase)
IDictionary.Item[Object]

Hämtar eller anger värdet som är associerat med den angivna nyckeln.

(Ärvd från DictionaryBase)
IDictionary.Keys

Hämtar ett ICollection objekt som innehåller nycklarna i objektet DictionaryBase .

(Ärvd från DictionaryBase)
IDictionary.Remove(Object)

Tar bort elementet med den angivna nyckeln från DictionaryBase.

(Ärvd från DictionaryBase)
IDictionary.Values

Hämtar ett ICollection objekt som innehåller värdena i objektet DictionaryBase .

(Ärvd från DictionaryBase)
IEnumerable.GetEnumerator()

Returnerar en IEnumerator som itererar via DictionaryBase.

(Ärvd från DictionaryBase)

Tilläggsmetoder

Name Description
AsParallel(IEnumerable)

Möjliggör parallellisering av en fråga.

AsQueryable(IEnumerable)

Konverterar en IEnumerable till en IQueryable.

Cast<TResult>(IEnumerable)

Omvandlar elementen i en IEnumerable till den angivna typen.

OfType<TResult>(IEnumerable)

Filtrerar elementen i en IEnumerable baserat på en angiven typ.

Gäller för

Se även