-
-
Save AlexKlugZetbit/d836dfc9a8d9537f501a303e4f33596f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.EntityFrameworkCore; | |
using Microsoft.Extensions.Configuration; | |
namespace PostgreSQL.Data | |
{ | |
public class AppDbContext : DbContext | |
{ | |
protected readonly IConfiguration Configuration; | |
public AppDbContext(IConfiguration configuration) | |
{ | |
Configuration = configuration; | |
} | |
protected override void OnConfiguring(DbContextOptionsBuilder options) | |
{ | |
// connect to postgres with connection string from app settings | |
options.UseNpgsql(Configuration.GetConnectionString("WebApiDatabase")); | |
} | |
public DbSet<Employee> Employees { get; set; } | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment