Table of Contents

Enum QueryType

Namespace
Cuemon.Data
Assembly
Cuemon.Data.dll

Identifies the type of data operation performed by a query against a data source.

public enum QueryType

Fields

Delete = 3

Indicates that a query is used for a data operation that deletes data.

Exists = 4

Indicates that a query is specifically used for a lookup on whether a data record exists.

Insert = 2

Indicates that a query is used for a data operation that inserts data.

Select = 0

Indicates that a query is used for a data operation that retrieves data.

Update = 1

Indicates 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

}
}