DiscoveryClientProtocol.ReadAll(String) Metode
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Membaca dalam file yang berisi peta dokumen penemuan tersimpan yang mengisi Documents properti dan References , dengan dokumen penemuan, skema Definisi Skema XML (XSD), dan deskripsi layanan yang direferensikan dalam file.
public:
System::Web::Services::Discovery::DiscoveryClientResultCollection ^ ReadAll(System::String ^ topLevelFilename);
public System.Web.Services.Discovery.DiscoveryClientResultCollection ReadAll(string topLevelFilename);
member this.ReadAll : string -> System.Web.Services.Discovery.DiscoveryClientResultCollection
Public Function ReadAll (topLevelFilename As String) As DiscoveryClientResultCollection
Parameter
- topLevelFilename
- String
Nama file yang akan dibaca, berisi peta dokumen penemuan tersimpan.
Mengembalikan
Yang DiscoveryClientResultCollection berisi hasil yang ditemukan dalam file dengan peta dokumen penemuan tersimpan. Format file adalah kelas yang DiscoveryClientProtocol.DiscoveryClientResultsFile diserialisasikan ke dalam XML; namun, seseorang biasanya akan membuat file hanya WriteAll(String, String) menggunakan metode atau Disco.exe.
Contoh
Contoh kode berikut adalah Formulir Web yang mengisi DataGrid dengan detail tentang dokumen dan referensi yang ditemukan dalam dokumen peta penemuan yang ada menggunakan metode .ReadAll
protected void Discover_Click(object Source, EventArgs e)
{
// Specify the URL to read the discovery results from.
string outputDirectory = DiscoDir.Text;
DiscoveryClientProtocol client = new DiscoveryClientProtocol();
// Use default credentials to access the files containing the discovery results.
client.Credentials = CredentialCache.DefaultCredentials;
try {
DiscoveryDocument doc;
// Read in existing discovery results.
DiscoveryClientResultCollection results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"));
}
catch ( Exception e2)
{
DiscoveryResultsGrid.Columns.Clear();
Status.Text = e2.Message;
}
// If discovery documents existed in the supplied folder, display the results in a data grid.
if (client.Documents.Count > 0)
PopulateGrid(client);
}
Public Sub Discover_Click(Source As Object, e as EventArgs )
' Specify the URL to read the discovery results from.
Dim outputDirectory As String = DiscoDir.Text
Dim client as DiscoveryClientProtocol = new DiscoveryClientProtocol()
' Use default credentials to access files containing the previously saved discovery results.
client.Credentials = CredentialCache.DefaultCredentials
Try
Dim doc As DiscoveryDocument
' Read in existing discovery results.
Dim results As DiscoveryClientResultCollection
results = client.ReadAll(Path.Combine(DiscoDir.Text,"results.discomap"))
Catch e2 As Exception
DiscoveryResultsGrid.Columns.Clear()
Status.Text = e2.Message
End Try
' If disocvery documents existed in the supplied folder, display the results in a data grid.
If (client.Documents.Count > 0) Then
' Populate the data grid with the discovery results.
PopulateGrid(client)
End If
End Sub
Keterangan
File yang berisi peta dokumen penemuan yang disimpan dapat dibuat oleh WriteAll metode atau Disco.exe.
Parameter topLevelFilename harus menyertakan jalur yang sepenuhnya memenuhi syarat jika file tidak ada di direktori saat ini.