Enum QueryType
Identifies the type of data operation performed by a query against a data source.
public enum QueryType
Fields
Delete = 3Indicates that a query is used for a data operation that deletes data.
Exists = 4Indicates that a query is specifically used for a lookup on whether a data record exists.
Insert = 2Indicates that a query is used for a data operation that inserts data.
Select = 0Indicates that a query is used for a data operation that retrieves data.
Update = 1Indicates that a query is used for a data operation that updates data.
Examples
The following example demonstrates how to use the QueryType enumeration to identify the type of a data operation.
using System;
using Cuemon.Data;
namespace MyApp.Examples;
public class QueryTypeExample
{
public static void Main()
{
var operation = QueryType.Select;
Console.WriteLine("Operation: {0} (value: {1})", operation, (int)operation);
operation = QueryType.Insert;
Console.WriteLine("Operation: {0} (value: {1})", operation, (int)operation);
// Use in a switch expression
string label = operation switch
{
QueryType.Select => "Read",
QueryType.Insert => "Create",
QueryType.Update => "Update",
QueryType.Delete => "Delete",
QueryType.Exists => "Check existence",
_ => "Unknown"
};
Console.WriteLine("Label: {0}", label);
// Output:
// Operation: Select (value: 0)
// Operation: Insert (value: 2)
// Label: Create
}
}