Skip to content

Instantly share code, notes, and snippets.

@StefanRiedmann
Created March 14, 2018 20:30
Show Gist options
  • Save StefanRiedmann/d17ed07b50f93ffdca33cae22bba4dcf to your computer and use it in GitHub Desktop.
Save StefanRiedmann/d17ed07b50f93ffdca33cae22bba4dcf to your computer and use it in GitHub Desktop.
DbContext for EntityFramework Core
using Microsoft.EntityFrameworkCore;
namespace TestProject
{
public class PersonContext : DbContext
{
DbSet<Person> Persons { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlServer("Server=localhost,1401; Database=PersonDb1;User=SA; Password=1StrongPassword!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment