예제 #1
0
 /// <summary>
 /// Return all <see cref="CharacterModel"/> for supplied account id.
 /// </summary>
 public List <CharacterModel> GetCharacters(uint accountId)
 {
     using var context = new CharacterContext(configuration);
     return(context.Characters
            .Where(c => c.AccountId == accountId)
            .ToList());
 }
예제 #2
0
 public void CreateCharacter(CharacterModel character)
 {
     using var context = new CharacterContext(configuration);
     context.Add(character);
     context.SaveChanges();
 }
예제 #3
0
 public CharacterModel GetCharacter(uint accountId, uint characterId)
 {
     using var context = new CharacterContext(configuration);
     return(context.Characters.SingleOrDefault(c => c.Id == characterId && c.AccountId == accountId));
 }
예제 #4
0
 public void Migrate()
 {
     using var context = new CharacterContext(configuration);
     context.Database.Migrate();
 }