1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 13:43:21 +08:00
osu-lazer/osu.Game/Configuration/DatabasedSetting.cs

52 lines
1.2 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
2018-04-13 17:19:50 +08:00
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.Database;
namespace osu.Game.Configuration
{
[Table("Settings")]
public class DatabasedSetting : IHasPrimaryKey // can be removed 20220315.
2018-04-13 17:19:50 +08:00
{
public int ID { get; set; }
public bool IsManaged => ID > 0;
2018-04-13 17:19:50 +08:00
public int? RulesetID { get; set; }
public int? Variant { get; set; }
public int? SkinInfoID { get; set; }
2018-04-13 17:19:50 +08:00
[Column("Key")]
public string Key { get; set; }
2018-04-13 17:19:50 +08:00
[Column("Value")]
public string StringValue
{
get => Value.ToString();
set => Value = value;
}
public object Value;
public DatabasedSetting(string key, object value)
2018-04-13 17:19:50 +08:00
{
Key = key;
Value = value;
}
/// <summary>
/// Constructor for derived classes that may require serialisation.
/// </summary>
public DatabasedSetting()
{
}
public override string ToString() => $"{Key}=>{Value}";
}
}