RelationshipQuery 构造函数

定义

初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class.

重载

RelationshipQuery()

初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class. 这是无参数构造函数。This is the parameterless constructor.

RelationshipQuery(String)

初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class. 如果可以将指定的字符串成功地分析为 WQL 查询,则认为该字符串是查询字符串;否则,将假定它是查询的源对象的路径。If the specified string can be successfully parsed as a WQL query, it is considered to be the query string; otherwise, it is assumed to be the path of the source object for the query. 在此情况下,假定该查询为实例查询。In this case, the query is assumed to be an instances query.

RelationshipQuery(String, String)

根据给定的源对象和关系类初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for the given source object and relationship class. 假定查询为实例查询(相对于架构查询)。The query is assumed to be an instance query (as opposed to a schema query).

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

使用给定的参数集,为架构查询初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for a schema query using the given set of parameters. 此构造函数仅用于架构查询,因此第一个参数必须为 true。This constructor is used for schema queries only, so the first parameter must be true.

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

按照给定的参数集初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for the given set of parameters. 假定查询为实例查询(相对于架构查询)。The query is assumed to be an instance query (as opposed to a schema query).

RelationshipQuery()

初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class. 这是无参数构造函数。This is the parameterless constructor.

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

注解

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅 从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于

RelationshipQuery(String)

初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class. 如果可以将指定的字符串成功地分析为 WQL 查询,则认为该字符串是查询字符串;否则,将假定它是查询的源对象的路径。If the specified string can be successfully parsed as a WQL query, it is considered to be the query string; otherwise, it is assumed to be the path of the source object for the query. 在此情况下,假定该查询为实例查询。In this case, the query is assumed to be an instances query.

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

查询字符串或此查询的类名。The query string or the class name for this query.

示例

下面的示例设置 WMI 类与之间的关系的类型 RelatedObjectQueryThe following example sets the type of relationship between a WMI class and 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 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅 从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于

RelationshipQuery(String, String)

根据给定的源对象和关系类初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for the given source object and relationship class. 假定查询为实例查询(相对于架构查询)。The query is assumed to be an instance query (as opposed to a schema query).

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

该查询的源对象的路径。The path of the source object for this query.

relationshipClass
String

要查询的关系的类型。The type of relationship for which to query.

注解

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅 从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于

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

使用给定的参数集,为架构查询初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for a schema query using the given set of parameters. 此构造函数仅用于架构查询,因此第一个参数必须为 true。This constructor is used for schema queries only, so the first parameter must be 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;否则为 falsetrue to indicate that this is a schema query; otherwise, false.

sourceObject
String

此查询的源类的路径。The path of the source class for this query.

relationshipClass
String

要查询的关系的类型。The type of relationship for which to query.

relationshipQualifier
String

需要在关系类中存在的限定符。A qualifier required to be present on the relationship class.

thisRole
String

源类需要在关系中扮演的角色。The role that the source class is required to play in the relationship.

注解

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅 从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于

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

按照给定的参数集初始化 RelationshipQuery 类的新实例。Initializes a new instance of the RelationshipQuery class for the given set of parameters. 假定查询为实例查询(相对于架构查询)。The query is assumed to be an instance query (as opposed to a schema query).

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

该查询的源对象的路径。The path of the source object for this query.

relationshipClass
String

要查询的关系的类型。The type of relationship for which to query.

relationshipQualifier
String

需要在关系对象中存在的限定符。A qualifier required to be present on the relationship object.

thisRole
String

源对象需要在关系中扮演的角色。The role that the source object is required to play in the relationship.

classDefinitionsOnly
Boolean

当此方法返回时,它包含一个布尔值,该值指示只返回结果对象的类定义。When this method returns, it contains a Boolean that indicates that only class definitions for the resulting objects are returned.

注解

.NET Framework 安全性.NET Framework Security

对直接调用方的完全信任。Full trust for the immediate caller. 此成员不能由部分信任的代码使用。This member cannot be used by partially trusted code. 有关详细信息,请参阅 从部分受信任的代码使用库For more information, see Using Libraries from Partially Trusted Code.

适用于