//
// NostaleDataContext.cs
//
// Copyright (c) František Boháček. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
using Microsoft.EntityFrameworkCore;
using NosSmooth.Data.Database.Data;
namespace NosSmooth.Data.Database;
///
/// Database context with NosTale data.
///
public class NostaleDataContext : DbContext
{
///
/// Initializes a new instance of the class.
///
/// The options.
public NostaleDataContext(DbContextOptions options)
: base(options)
{
}
///
/// Gets the translations set.
///
public DbSet Translations => Set();
///
/// Gets the items set.
///
public DbSet Items => Set();
///
/// Gets the maps set.
///
public DbSet Maps => Set();
///
/// Gets the monsters set.
///
public DbSet Monsters => Set();
///
/// Gets the skills set.
///
public DbSet Skills => Set();
///
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity()
.Property(x => x.Data)
.HasConversion
(
x => string.Join("|", x),
x => x.Split(',', StringSplitOptions.RemoveEmptyEntries)
);
modelBuilder.Entity().HasKey("Language", "Root", "Key");
modelBuilder.Entity().Ignore(x => x.Name);
modelBuilder.Entity().Ignore(x => x.Name);
modelBuilder.Entity().Ignore(x => x.Name);
modelBuilder.Entity().Ignore(x => x.Name);
base.OnModelCreating(modelBuilder);
}
}