DiscoveryClientProtocol.ReadAll(String) 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
读入包含已保存的发现文档的映射的文件,并使用该文件中引用的发现文档、XML 架构定义 (XSD) 架构和服务说明填充 Documents 和 References 属性。
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
参数
- topLevelFilename
- String
要读入的文件的名称,该文件包含已保存发现文档的映射。
返回
DiscoveryClientResultCollection,它包含在具有已保存发现文档的映射的文件中找到的结果。 文件格式是已序列化为 XML 的 DiscoveryClientProtocol.DiscoveryClientResultsFile 类;然而,通常只使用 WriteAll(String, String) 方法或 Disco.exe 创建该文件。
示例
下面的代码示例是一个 Web 窗体, DataGrid 它使用 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
注解
方法或Disco.exe可以创建 WriteAll 包含已保存发现文档映射的文件。
如果当前目录中不存在文件,该 topLevelFilename
参数必须包含完全限定的路径。