using System; using Microsoft.Data.Entity; using Microsoft.Data.Entity.Metadata; using Microsoft.Framework.OptionsModel; namespace MusicStore.Models { public class MusicStoreContext : DbContext { public MusicStoreContext(IServiceProvider serviceProvider, IOptionsAccessor optionsAccessor) : base(serviceProvider, optionsAccessor.Options) { } public DbSet Albums { get; set; } public DbSet Artists { get; set; } public DbSet Orders { get; set; } public DbSet Genres { get; set; } public DbSet CartItems { get; set; } public DbSet OrderDetails { get; set; } protected override void OnModelCreating(ModelBuilder builder) { builder.Entity().Key(a => a.AlbumId); builder.Entity().Key(a => a.ArtistId); builder.Entity().Key(o => o.OrderId).StorageName("Order"); builder.Entity().Key(g => g.GenreId); builder.Entity().Key(c => c.CartItemId); builder.Entity().Key(o => o.OrderDetailId); } } public class MusicStoreDbContextOptions : DbContextOptions { } }