I18NCommander/I18N Commander/DataModel/Database/Setting.cs

44 lines
1.2 KiB
C#
Raw Normal View History

2022-06-12 15:15:09 +00:00
using System.ComponentModel.DataAnnotations;
2022-11-14 19:32:41 +00:00
using DataModel.Database.Common;
2022-06-12 15:15:09 +00:00
namespace DataModel.Database;
2022-06-12 19:42:47 +00:00
public sealed class Setting
2022-06-12 15:15:09 +00:00
{
[Key]
public int Id { get; set; }
public Guid UniqueId { get; set; }
2022-07-25 17:03:49 +00:00
public string Code { get; set; } = string.Empty;
2022-06-12 15:15:09 +00:00
public string TextValue { get; set; } = string.Empty;
public bool BoolValue { get; set; }
public int IntegerValue { get; set; }
public Guid GuidValue { get; set; }
2022-11-14 19:32:41 +00:00
internal DataContext.JsonUniqueId JsonUniqueId => new(this.Code, this.UniqueId, "Set");
internal DataContext.JsonSetting ToJsonSetting() => new()
{
UniqueId = this.JsonUniqueId,
Code = this.Code,
BoolValue = this.BoolValue,
GuidValue = this.GuidValue,
IntegerValue = this.IntegerValue,
TextValue = this.TextValue,
};
internal static Setting FromJsonSetting(DataContext.JsonSetting jsonSetting) => new()
{
UniqueId = jsonSetting.UniqueId.UniqueId,
Code = jsonSetting.Code,
BoolValue = jsonSetting.BoolValue,
GuidValue = jsonSetting.GuidValue,
IntegerValue = jsonSetting.IntegerValue,
TextValue = jsonSetting.TextValue,
};
2022-06-12 15:15:09 +00:00
}