RelationshipQuery 构造函数

定义

初始化 RelationshipQuery 类的新实例。

重载

RelationshipQuery()

初始化 RelationshipQuery 类的新实例。 这是无参数构造函数。

RelationshipQuery(String)

初始化 RelationshipQuery 类的新实例。 如果可以将指定的字符串成功地分析为 WQL 查询,则认为该字符串是查询字符串;否则,将假定它是查询的源对象的路径。 在此情况下,假定该查询为实例查询。

RelationshipQuery(String, String)

根据给定的源对象和关系类初始化 RelationshipQuery 类的新实例。 假定查询为实例查询(相对于架构查询)。

RelationshipQuery(Boolean, String, String, String, String)

使用给定的参数集,为架构查询初始化 RelationshipQuery 类的新实例。 此构造函数仅用于架构查询,因此第一个参数必须为 true。

RelationshipQuery(String, String, String, String, Boolean)

按照给定的参数集初始化 RelationshipQuery 类的新实例。 假定查询为实例查询(相对于架构查询)。

RelationshipQuery()

初始化 RelationshipQuery 类的新实例。 这是无参数构造函数。

public:
 RelationshipQuery();
public RelationshipQuery ();
Public Sub New ()

注解

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码的库

适用于

RelationshipQuery(String)

初始化 RelationshipQuery 类的新实例。 如果可以将指定的字符串成功地分析为 WQL 查询,则认为该字符串是查询字符串;否则,将假定它是查询的源对象的路径。 在此情况下,假定该查询为实例查询。

public:
 RelationshipQuery(System::String ^ queryOrSourceObject);
public RelationshipQuery (string queryOrSourceObject);
new System.Management.RelationshipQuery : string -> System.Management.RelationshipQuery
Public Sub New (queryOrSourceObject As String)

参数

queryOrSourceObject
String

查询字符串或此查询的类名。

示例

以下示例设置 WMI 类与 a RelatedObjectQuery之间的关系类型。

using System;
using System.Management;

class Sample
{
    public static void Main(string[] args)
    {
        // Full query string is specified
        // to the constructor
        RelationshipQuery q =
            new RelationshipQuery(
            "references of {Win32_ComputerSystem.Name='mymachine'}");

        // Only the object of interest is
        // specified to the constructor
        RelationshipQuery query =
            new RelationshipQuery("Win32_Service.Name='Alerter'");
    }
}
Imports System.Management


Public Class Sample
    Public Overloads Shared Function _
        Main(ByVal args() As String) As Integer

        ' Full query string is specified
        ' to the constructor
        Dim q As New RelationshipQuery( _
            "references of {Win32_ComputerSystem.Name='mymachine'}")

        ' Only the object of interest is
        ' specified to the constructor
        Dim query As New RelationshipQuery( _
            "Win32_Service.Name='Alerter'")

    End Function
End Class

注解

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码的库

适用于

RelationshipQuery(String, String)

根据给定的源对象和关系类初始化 RelationshipQuery 类的新实例。 假定查询为实例查询(相对于架构查询)。

public:
 RelationshipQuery(System::String ^ sourceObject, System::String ^ relationshipClass);
public RelationshipQuery (string sourceObject, string relationshipClass);
new System.Management.RelationshipQuery : string * string -> System.Management.RelationshipQuery
Public Sub New (sourceObject As String, relationshipClass As String)

参数

sourceObject
String

该查询的源对象的路径。

relationshipClass
String

要查询的关系的类型。

注解

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码的库

适用于

RelationshipQuery(Boolean, String, String, String, String)

使用给定的参数集,为架构查询初始化 RelationshipQuery 类的新实例。 此构造函数仅用于架构查询,因此第一个参数必须为 true。

public:
 RelationshipQuery(bool isSchemaQuery, System::String ^ sourceObject, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ thisRole);
public RelationshipQuery (bool isSchemaQuery, string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole);
new System.Management.RelationshipQuery : bool * string * string * string * string -> System.Management.RelationshipQuery
Public Sub New (isSchemaQuery As Boolean, sourceObject As String, relationshipClass As String, relationshipQualifier As String, thisRole As String)

参数

isSchemaQuery
Boolean

如果指示这是架构查询,则为 true;否则为 false

sourceObject
String

此查询的源类的路径。

relationshipClass
String

要查询的关系的类型。

relationshipQualifier
String

需要在关系类中存在的限定符。

thisRole
String

源类需要在关系中扮演的角色。

注解

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码的库

适用于

RelationshipQuery(String, String, String, String, Boolean)

按照给定的参数集初始化 RelationshipQuery 类的新实例。 假定查询为实例查询(相对于架构查询)。

public:
 RelationshipQuery(System::String ^ sourceObject, System::String ^ relationshipClass, System::String ^ relationshipQualifier, System::String ^ thisRole, bool classDefinitionsOnly);
public RelationshipQuery (string sourceObject, string relationshipClass, string relationshipQualifier, string thisRole, bool classDefinitionsOnly);
new System.Management.RelationshipQuery : string * string * string * string * bool -> System.Management.RelationshipQuery
Public Sub New (sourceObject As String, relationshipClass As String, relationshipQualifier As String, thisRole As String, classDefinitionsOnly As Boolean)

参数

sourceObject
String

该查询的源对象的路径。

relationshipClass
String

要查询的关系的类型。

relationshipQualifier
String

需要在关系对象中存在的限定符。

thisRole
String

源对象需要在关系中扮演的角色。

classDefinitionsOnly
Boolean

当此方法返回时,它包含一个布尔值,该值指示只返回结果对象的类定义。

注解

.NET Framework 安全性

对直接调用方的完全信任。 此成员不能由部分信任的代码使用。 有关详细信息,请参阅 使用部分受信任的代码的库

适用于