64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using SQLVision.Core.Enums;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace SQLVision.Core.Models;
|
|
|
|
public class ScriptMetadata
|
|
{
|
|
[JsonPropertyName("id")]
|
|
public string Id { get; set; } = Guid.NewGuid().ToString();
|
|
|
|
[JsonPropertyName("fileName")]
|
|
public string FileName { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("fullPath")]
|
|
public string FullPath { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("description")]
|
|
public string? Description { get; set; }
|
|
|
|
[JsonPropertyName("rawSql")]
|
|
public string RawSql { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("processedSql")]
|
|
public string ProcessedSql { get; set; } = string.Empty;
|
|
|
|
[JsonPropertyName("connectionString")]
|
|
public string? ConnectionString { get; set; }
|
|
|
|
[JsonPropertyName("databaseProvider")]
|
|
public DatabaseProvider DatabaseProvider { get; set; } = DatabaseProvider.SqlServer;
|
|
|
|
[JsonPropertyName("parameters")]
|
|
public List<ScriptParameter> Parameters { get; set; } = new();
|
|
|
|
[JsonPropertyName("outputs")]
|
|
public List<OutputDefinition> Outputs { get; set; } = new();
|
|
|
|
[JsonPropertyName("metadata")]
|
|
public Dictionary<string, object> Metadata { get; set; } = new();
|
|
|
|
[JsonPropertyName("lastModified")]
|
|
public DateTime LastModified { get; set; } = DateTime.UtcNow;
|
|
|
|
[JsonPropertyName("category")]
|
|
public string? Category { get; set; }
|
|
|
|
[JsonPropertyName("tags")]
|
|
public List<string> Tags { get; set; } = new();
|
|
|
|
[JsonPropertyName("executionCount")]
|
|
public int ExecutionCount { get; set; }
|
|
|
|
[JsonPropertyName("averageExecutionTime")]
|
|
public TimeSpan AverageExecutionTime { get; set; }
|
|
|
|
[JsonIgnore]
|
|
public string DisplayName => !string.IsNullOrEmpty(Description)
|
|
? Description
|
|
: Path.GetFileNameWithoutExtension(FileName);
|
|
|
|
[JsonIgnore]
|
|
public bool IsVisible { get; set; } = true;
|
|
}
|