Добавьте файлы проекта.
This commit is contained in:
66
SQLVision.Core/Models/ScriptParameter.cs
Normal file
66
SQLVision.Core/Models/ScriptParameter.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
using SQLVision.Core.Enums;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace SQLVision.Core.Models;
|
||||
|
||||
public class ScriptParameter
|
||||
{
|
||||
[JsonPropertyName("name")]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
[JsonPropertyName("type")]
|
||||
public ParameterType Type { get; set; } = ParameterType.String;
|
||||
|
||||
[JsonPropertyName("displayName")]
|
||||
public string? DisplayName { get; set; }
|
||||
|
||||
[JsonPropertyName("description")]
|
||||
public string? Description { get; set; }
|
||||
|
||||
[JsonPropertyName("defaultValue")]
|
||||
public object? DefaultValue { get; set; }
|
||||
|
||||
[JsonPropertyName("isRequired")]
|
||||
public bool IsRequired { get; set; } = false;
|
||||
|
||||
[JsonPropertyName("order")]
|
||||
public int Order { get; set; } = 0;
|
||||
|
||||
[JsonPropertyName("group")]
|
||||
public string? Group { get; set; }
|
||||
|
||||
[JsonPropertyName("tableQuery")]
|
||||
public string? TableQuery { get; set; }
|
||||
|
||||
[JsonPropertyName("valueMember")]
|
||||
public string ValueMember { get; set; } = "Id";
|
||||
|
||||
[JsonPropertyName("displayMember")]
|
||||
public string DisplayMember { get; set; } = "Name";
|
||||
|
||||
[JsonPropertyName("dependsOn")]
|
||||
public string? DependsOn { get; set; }
|
||||
|
||||
[JsonPropertyName("dependencyValues")]
|
||||
public Dictionary<string, object>? DependencyValues { get; set; }
|
||||
|
||||
[JsonPropertyName("validationRules")]
|
||||
public Dictionary<string, object>? ValidationRules { get; set; }
|
||||
|
||||
[JsonPropertyName("watermark")]
|
||||
public string? Watermark { get; set; }
|
||||
|
||||
[JsonPropertyName("icon")]
|
||||
public string? Icon { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
public string EffectiveDisplayName => DisplayName ?? Name;
|
||||
|
||||
public bool Validate(object? value)
|
||||
{
|
||||
if (IsRequired && (value == null || string.IsNullOrWhiteSpace(value.ToString())))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user