chaosbot/ChaosBot/Database/Entity/Raffle.cs

45 lines
1.0 KiB
C#

using System;
using System.Data;
using ChaosBot.Attribute;
namespace ChaosBot.Database.Entity
{
[DBEntity("RaffleTable")]
public class Raffle : BaseEntity
{
[DBPrimaryKey]
[DBAutoIncrement]
[DBNotNull]
[DBUnique]
public Nullable<int> id { get; private set; }
public long userId { get; private set; }
public long guildId { get; private set; }
public Raffle() {}
public Raffle(int id, long userId, long guildId)
{
this.id = id;
this.userId = userId;
this.guildId = guildId;
}
public Raffle(long userId, long guildId)
{
this.userId = userId;
this.guildId = guildId;
}
public static QueryBuilder<Raffle> Query()
{
return BaseEntity.Query<Raffle>();
}
public override void SetFromRow(DataRow row)
{
id = (int)row["id"];
userId = (long)row["userid"];
guildId = (long) row["guildid"];
}
}
}