-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRentACarDbContext.cs
32 lines (30 loc) · 1.59 KB
/
RentACarDbContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using Microsoft.EntityFrameworkCore;
using RentACarBackend.Models.Cars;
using RentACarBackend.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
namespace RentACarBackend
{
public class RentACarDbContext : DbContext
{
public RentACarDbContext(DbContextOptions<RentACarDbContext> options) : base(options) { }
public DbSet<Company> Companies { get; set; }
public DbSet<Country> Countries { get; set; }
public DbSet<Manufacturer> Manufacturers { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) => optionsBuilder.UseLazyLoadingProxies().UseSqlite(@"Filename=./rent_a_car.db");
protected override void OnModelCreating(ModelBuilder modelBuilder) => modelBuilder.Entity<Company>().ToTable("companies");
public DbSet<CarType> CarType { get; set; }
public DbSet<RentACarBackend.Models.Cars.Fuel> Fuel { get; set; }
public DbSet<RentACarBackend.Models.Cars.Color> Color { get; set; }
public DbSet<RentACarBackend.Models.Cars.Powertrain> Powertrain { get; set; }
public DbSet<RentACarBackend.Models.Cars.Transmission> Transmission { get; set; }
public DbSet<RentACarBackend.Models.Cars.Engine> Engine { get; set; }
public DbSet<RentACarBackend.Models.Cars.Model> Model { get; set; }
public DbSet<RentACarBackend.Models.Cars.Car> Car { get; set; }
public DbSet<RentACarBackend.Models.Rent> Rent { get; set; }
public DbSet<RentACarBackend.Models.Client> Client { get; set; }
}
}