Created
April 25, 2021 06:51
-
-
Save teyc/3ef06e60229c80c69b580d9859805292 to your computer and use it in GitHub Desktop.
Prototyping web applications
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
// <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="3.1.3" /> | |
public class BloggingContext : DbContext | |
{ | |
public DbSet<Blog> Blogs { get; set; } | |
public DbSet<Post> Posts { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) | |
=> optionsBuilder.UseNpgsql("Host=my_host;Database=my_db;Username=my_user;Password=my_pw"); | |
} | |
// Database first | |
// dotnet ef dbcontext scaffold "Host=my_host;Database=my_db;Username=my_user;Password=my_pw" Npgsql.EntityFrameworkCore.PostgreSQL |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment