Skip to content

Instantly share code, notes, and snippets.

@fugaku
Created February 16, 2019 02:18
Show Gist options
  • Select an option

  • Save fugaku/4ecc86347066755cc8ecbc01de67ac1b to your computer and use it in GitHub Desktop.

Select an option

Save fugaku/4ecc86347066755cc8ecbc01de67ac1b to your computer and use it in GitHub Desktop.
EF Core Getting Started
public void ConfigureServices(IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
// This lambda determines whether user consent for non-essential cookies is needed for a given request.
options.CheckConsentNeeded = context => true;
options.MinimumSameSitePolicy = SameSiteMode.None;
});
var connection = "Server=localhost;Port=5432;Database=Test;User Id=postgres;Password=postgres;";
services.AddDbContext<AppContext>(options => options.UseNpgsql(connection));
services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment