added new projects and some base code for persistence
This commit is contained in:
23
Tv7Playlist.Data/PlaylistContext.cs
Normal file
23
Tv7Playlist.Data/PlaylistContext.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Tv7Playlist.Data
|
||||
{
|
||||
public class PlaylistContext : DbContext
|
||||
{
|
||||
public PlaylistContext(DbContextOptions<PlaylistContext> options)
|
||||
: base(options)
|
||||
{
|
||||
}
|
||||
|
||||
public DbSet<PlaylistEntry> PlaylistEntries { get; set; }
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
base.OnModelCreating(modelBuilder);
|
||||
|
||||
var entityTypeBuilder = modelBuilder.Entity<PlaylistEntry>();
|
||||
entityTypeBuilder.HasKey(e => e.Id);
|
||||
entityTypeBuilder.HasAlternateKey(e => e.TrackNumber);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user