RelationshipQuery Constructors
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Initializes a new instance of the RelationshipQuery class.
Overloads
RelationshipQuery() |
Initializes a new instance of the RelationshipQuery class. This is the parameterless constructor. |
RelationshipQuery(String) |
Initializes a new instance of the RelationshipQuery class. 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) |
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) |
Initializes a new instance of the RelationshipQuery class for a schema query using the given set of parameters. This constructor is used for schema queries only, so the first parameter must be true. |
RelationshipQuery(String, String, String, String, Boolean) |
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()
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
Initializes a new instance of the RelationshipQuery class. This is the parameterless constructor.
public:
RelationshipQuery();
public RelationshipQuery ();
Public Sub New ()
Remarks
.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.
Applies to
RelationshipQuery(String)
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
Initializes a new instance of the RelationshipQuery class. 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)
Parameters
- queryOrSourceObject
- String
The query string or the class name for this query.
Examples
The 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
Remarks
.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.
Applies to
RelationshipQuery(String, String)
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
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)
Parameters
- sourceObject
- String
The path of the source object for this query.
- relationshipClass
- String
The type of relationship for which to query.
Remarks
.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.
Applies to
RelationshipQuery(Boolean, String, String, String, String)
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
Initializes a new instance of the RelationshipQuery class for a schema query using the given set of parameters. 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)
Parameters
- isSchemaQuery
- Boolean
true
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.
Remarks
.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.
Applies to
RelationshipQuery(String, String, String, String, Boolean)
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
- Source:
- ManagementQuery.cs
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)
Parameters
- 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.
Remarks
.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.
Applies to
.NET