Skip to content

Instantly share code, notes, and snippets.

@SafaElmali
Last active May 3, 2019 21:44
Show Gist options
  • Save SafaElmali/6b86c4574c90614ce739157213b4bdd2 to your computer and use it in GitHub Desktop.
Save SafaElmali/6b86c4574c90614ce739157213b4bdd2 to your computer and use it in GitHub Desktop.
Context file
using Microsoft.EntityFrameworkCore;
namespace EFCore.Models {
public class EFContext : DbContext {
private const string connectionString = "Server=.\\;Database=EFCore;Trusted_Connection=True;";
protected override void OnConfiguring (DbContextOptionsBuilder optionsBuilder) {
optionsBuilder.UseSqlServer (connectionString);
}
public DbSet<Product> Products { get; set; }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment