40 lines
1.4 KiB
C#
40 lines
1.4 KiB
C#
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;
|
|
|
|
public static readonly Dictionary<Type, SqliteType> DataTypes = new Dictionary<Type, SqliteType>
|
|
{
|
|
{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 DBEntity(string table)
|
|
{
|
|
this.Table = table;
|
|
}
|
|
}
|
|
} |