Updated Setting
Updated Seting class to use string for teh data, and the data is the full setting line, to allow for the flexability for Any data value in the field. Implemented MarshalData() and JsonData() functions.
This commit is contained in:
parent
09cd72b278
commit
8e65cc3a4b
1 changed files with 13 additions and 11 deletions
|
|
@ -8,17 +8,19 @@ public class Setting : IDataModel
|
|||
{
|
||||
#pragma warning disable CS8618
|
||||
public string _id { get; set; } = string.Empty;
|
||||
public string? ValueJson { get; set; }
|
||||
#pragma warning restore CS8618
|
||||
|
||||
public object Value
|
||||
{
|
||||
#pragma warning disable CS8603
|
||||
get => string.IsNullOrEmpty(ValueJson) ? null : JsonSerializer.Deserialize<object>(ValueJson);
|
||||
#pragma warning restore CS8603
|
||||
set => ValueJson = JsonSerializer.Serialize(value);
|
||||
}
|
||||
|
||||
public string value { get; set; } = string.Empty;
|
||||
|
||||
public string Id() => _id;
|
||||
public bool EqualId(string oid) => _id == oid;
|
||||
|
||||
public void MarshalData(string id, string data)
|
||||
{
|
||||
_id = id;
|
||||
value = data;
|
||||
}
|
||||
|
||||
public string JsonData()
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue