sockscape/server/DAL/ScapeDb.cs

34 lines
1 KiB
C#
Raw Normal View History

using System;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using Config = SockScape.Configuration;
2017-06-05 12:20:39 +00:00
namespace SockScape.DAL {
2017-06-05 12:20:39 +00:00
[DbConfigurationType(typeof(MySql.Data.Entity.MySqlEFConfiguration))]
public partial class ScapeDb : DbContext {
static ScapeDb() {
2017-06-05 12:20:39 +00:00
DbConfiguration.SetConfiguration(new MySql.Data.Entity.MySqlEFConfiguration());
}
2017-06-05 12:20:39 +00:00
public ScapeDb()
: base("server="+ Config.Database["Server"]
+";user id="+ Config.Database["Username"]
+";password="+ Config.Database["Password"]
+";persistsecurityinfo=True;"
+"database="+ Config.Database["Database"])
2017-06-05 12:20:39 +00:00
{
}
2017-06-05 12:20:39 +00:00
public DbSet<User> Users { get; set; }
public DbSet<Origin> Origins { get; set; }
2017-06-06 21:13:25 +00:00
public DbSet<Session> Sessions { get; set; }
2017-06-05 12:20:39 +00:00
protected override void OnModelCreating(DbModelBuilder modelBuilder) {
base.OnModelCreating(modelBuilder);
}
}
}