SES-65 #5
@ -24,26 +24,7 @@ namespace SessionCompanion.Database
|
|||||||
protected override void OnModelCreating(ModelBuilder builder)
|
protected override void OnModelCreating(ModelBuilder builder)
|
||||||
{
|
{
|
||||||
base.OnModelCreating(builder);
|
base.OnModelCreating(builder);
|
||||||
builder.Entity<User>().HasData(
|
builder.Entity<User>().HasData(SeedData.SeedUsers());
|
||||||
s426135 marked this conversation as resolved
Outdated
|
|||||||
new
|
|
||||||
{
|
|
||||||
Id = 1,
|
|
||||||
Nickname = "Morwiec",
|
|
||||||
Password = "123"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 2,
|
|
||||||
Nickname = "Cichoklepiec",
|
|
||||||
Password = "123"
|
|
||||||
},
|
|
||||||
new
|
|
||||||
{
|
|
||||||
Id = 3,
|
|
||||||
Nickname = "Ruletka",
|
|
||||||
Password = "123"
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
39
SessionCompanion/SessionCompanion.Database/SeedData.cs
Normal file
39
SessionCompanion/SessionCompanion.Database/SeedData.cs
Normal file
@ -0,0 +1,39 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using SessionCompanion.Database.Tables;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace SessionCompanion.Database
|
||||||
|
{
|
||||||
|
public class SeedData
|
||||||
|
{
|
||||||
|
static public List<User> SeedUsers()
|
||||||
|
{
|
||||||
|
List<User> users = new List<User>
|
||||||
|
{
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 1,
|
||||||
|
Nickname = "Morwiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 2,
|
||||||
|
Nickname = "Cichoklepiec",
|
||||||
|
Password = "123"
|
||||||
|
},
|
||||||
|
new User
|
||||||
|
{
|
||||||
|
Id = 3,
|
||||||
|
Nickname = "Ruletka",
|
||||||
|
Password = "123"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return users;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user
Przenieśmy to do osobnych plików, bo zacznie ię niedługo robić syfek jak ostatnio.