mirror of
https://github.com/Artemis-RGB/Artemis
synced 2026-11-11 19:36:28 +00:00
28 lines
800 B
C#
28 lines
800 B
C#
using Artemis.Storage.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Artemis.Storage
|
|
{
|
|
internal class StorageContext : DbContext
|
|
{
|
|
internal DbSet<Profile> Profiles { get; set; }
|
|
internal DbSet<Setting> Settings { get; set; }
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
|
{
|
|
optionsBuilder.UseSqlite("Data Source=Storage.db");
|
|
}
|
|
|
|
#region Overrides of DbContext
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
// Composite keys must be configured with fluent API in Core
|
|
modelBuilder.Entity<Layer>().HasKey(l => new {l.ProfileId, l.Name});
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |