123 lines
3.8 KiB
C#
123 lines
3.8 KiB
C#
namespace Strata.SqlTools.EFCore.Models;
|
|
|
|
/// <summary>
|
|
/// Represents a SQL query breakdown entity for Entity Framework Core mapping.
|
|
/// This entity encapsulates the query components (SELECT, FROM, WHERE, etc.)
|
|
/// and is designed to be compatible with EF Core DbContext and database models.
|
|
/// </summary>
|
|
public class QueryBreakdownEntity
|
|
{
|
|
/// <summary>
|
|
/// Gets or sets the unique identifier for this query breakdown.
|
|
/// </summary>
|
|
public int Id { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the SELECT clause of the query.
|
|
/// </summary>
|
|
public string? SelectClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the SELECT clause.
|
|
/// </summary>
|
|
public string? SelectClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the FROM clause of the query.
|
|
/// </summary>
|
|
public string? FromClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the FROM clause.
|
|
/// </summary>
|
|
public string? FromClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the WHERE clause of the query.
|
|
/// </summary>
|
|
public string? WhereClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the WHERE clause.
|
|
/// </summary>
|
|
public string? WhereClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the GROUP BY clause of the query.
|
|
/// </summary>
|
|
public string? GroupByClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the GROUP BY clause.
|
|
/// </summary>
|
|
public string? GroupByClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the HAVING clause of the query.
|
|
/// </summary>
|
|
public string? HavingClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the HAVING clause.
|
|
/// </summary>
|
|
public string? HavingClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the ORDER BY clause of the query.
|
|
/// </summary>
|
|
public string? OrderByClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the comment for the ORDER BY clause.
|
|
/// </summary>
|
|
public string? OrderByClauseComment { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the WITH clause (Common Table Expressions) as a JSON string.
|
|
/// </summary>
|
|
public string? WithClause { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the raw/original SQL statement before parsing and breakdown.
|
|
/// </summary>
|
|
public string? RawSql { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the setup clauses as a JSON string.
|
|
/// These are clauses to execute before the main statement.
|
|
/// </summary>
|
|
public string? SetupClausesJson { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the finish clauses as a JSON string.
|
|
/// These are clauses to execute after the main statement.
|
|
/// </summary>
|
|
public string? FinishClausesJson { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the parameters as a JSON string.
|
|
/// Contains parameter names and their values.
|
|
/// </summary>
|
|
public string? ParametersJson { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timestamp when this entity was created.
|
|
/// </summary>
|
|
public DateTime CreatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the timestamp when this entity was last updated.
|
|
/// </summary>
|
|
public DateTime UpdatedAt { get; set; }
|
|
|
|
/// <summary>
|
|
/// Navigation property for the related query parameters.
|
|
/// </summary>
|
|
public virtual ICollection<QueryParameterEntity> Parameters { get; set; } = new List<QueryParameterEntity>();
|
|
|
|
/// <summary>
|
|
/// Navigation property for the related WITH clauses (CTEs).
|
|
/// </summary>
|
|
public virtual ICollection<WithClauseEntity> WithClauses { get; set; } = new List<WithClauseEntity>();
|
|
}
|