Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using Microsoft.EntityFrameworkCore;
- namespace KatalogGier
- {
- public class GamesContext : DbContext
- {
- internal DbSet<Game> Games { get; set; }
- internal DbSet<Publisher> Publisher { get; set; }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- optionsBuilder.UseSqlite($"Data Source={Directory.GetCurrentDirectory}\\game.db");
- }
- protected override void OnModelCreating(ModelBuilder modelBuilder)
- {
- modelBuilder.Entity<Game>()
- .HasOne(p => p.Publisher)
- .WithMany(g => g.Games);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement