using System; using System.Collections.Generic; using Microsoft.Data.Sqlite; namespace ChaosBot.Attribute { [AttributeUsage(AttributeTargets.Class)] public class DBEntity : System.Attribute { public readonly string Table; // Yeah... this table does not exist elsewhere except human-readable documentation public static readonly Dictionary DataTypes = new Dictionary { {typeof(bool), SqliteType.Integer}, {typeof(byte), SqliteType.Integer}, {typeof(byte[]), SqliteType.Blob}, {typeof(char), SqliteType.Text}, {typeof(DateTime), SqliteType.Text}, {typeof(DateTimeOffset), SqliteType.Text}, {typeof(Decimal), SqliteType.Text}, {typeof(Double), SqliteType.Real}, {typeof(Guid), SqliteType.Text}, {typeof(Int16), SqliteType.Integer}, {typeof(Int32), SqliteType.Integer}, {typeof(Int64), SqliteType.Integer}, {typeof(SByte), SqliteType.Integer}, {typeof(Single), SqliteType.Real}, {typeof(String), SqliteType.Text}, {typeof(TimeSpan), SqliteType.Text}, {typeof(UInt16), SqliteType.Integer}, {typeof(UInt32), SqliteType.Integer}, {typeof(UInt64), SqliteType.Integer} }; public static readonly Dictionary ConstrainNames = new Dictionary { {typeof(DBNotNull), "nn"}, {typeof(DBUnique), "uq"}, {typeof(DBPrimaryKey), "pk"}, {typeof(DBAutoIncrement), "ai"}, }; public DBEntity(string table) { this.Table = table; } } }