IW4M-Admin/SharedLibrary/Database/Initializer.cs

43 lines
1.1 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SharedLibrary.Database
{
2017-11-29 19:35:50 -05:00
public class Initializer : DropCreateDatabaseIfModelChanges<DatabaseContext>
{
2017-11-29 19:35:50 -05:00
protected override void Seed(DatabaseContext context)
{
2017-11-29 19:35:50 -05:00
var aliasLink = new Models.EFAliasLink();
var currentAlias = new Models.EFAlias()
{
Active = true,
DateAdded = DateTime.UtcNow,
IPAddress = 0,
2017-11-29 19:35:50 -05:00
Name = "IW4MAdmin",
Link = aliasLink
};
context.Clients.Add(new Models.EFClient()
{
Active = false,
Connections = 0,
FirstConnection = DateTime.UtcNow,
LastConnection = DateTime.UtcNow,
Level = Objects.Player.Permission.Console,
Masked = true,
NetworkId = 0,
2017-11-29 19:35:50 -05:00
AliasLink = aliasLink,
CurrentAlias = currentAlias
});
base.Seed(context);
}
}
}