Class CommandInfo
- Namespace
- YndigoBlue.Velocity.Model
- Assembly
- YndigoBlue.Velocity.dll
Provides timing and diagnostic information for database command execution.
public class CommandInfo
- Inheritance
-
CommandInfo
Examples
Tracking command execution time:
using (Manager manager = new Manager(connection))
{
manager.LoadSchema("my_schema");
Schema schema = manager.GetSchema("my_schema");
Table usersTable = schema["users"];
Query query = new Query();
query.AddFromItem(usersTable);
query.AddSelectItem(usersTable["id"]);
query.AddSelectItem(usersTable["username"]);
// CommandInfo tracks timing internally
Stopwatch sw = Stopwatch.StartNew();
IEnumerable<Result> results = manager.Retrieve(query);
sw.Stop();
Console.WriteLine($"Query took: {sw.Elapsed.TotalMilliseconds}ms");
}
Understanding command types:
// Different commands tracked:
// - CommandType.Query: SELECT queries
// - CommandType.Update: UPDATE statements
// - CommandType.Insert: INSERT statements
// - CommandType.Delete: DELETE statements
// - CommandType.BuildSchema: Schema creation
// - CommandType.Import: Data import operations
// - CommandType.Export: Data export operations
Remarks
CommandInfo tracks the execution time and type of database operations performed by Velocity. Each command executed through Manager can optionally collect timing information for performance monitoring and diagnostics.
CommandInfo instances are typically created internally by Velocity's command execution infrastructure. They record the start and end time of operations like queries, updates, schema builds, and data imports.
Use the Duration property to access total execution time after a command completes.
Constructors
- CommandInfo(CommandType)
Creates a new CommandInfo instance for tracking the specified command type.
Properties
- CommandType
Gets the type of database command being tracked.
- Duration
Gets the total elapsed time for the command execution.
Methods
- ToString()
Returns a string representation of the command information.