August 2018
Intermediate to advanced
298 pages
5h 33m
English
The instance of the DbContext class represents the session to the database and this DbContext class does most of the heavy lifting of your data access for your application. Create a new class named EmployeeDbContext with the following content:
using Microsoft.EntityFrameworkCore;namespace ConsoleEF{ public class EmployeeDbContext : DbContext { public DbSet<Employee> Employees { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) { optionsBuilder.UseSqlServer(@"Data Source= (localdb)\MSSQLLocalDB;Initial Catalog= EFConsole;Integrated Security=True;Connect Timeout=30; Encrypt=False;TrustServerCertificate=True; ApplicationIntent=ReadWrite; ...Read now
Unlock full access