Last active
June 10, 2020 18:24
-
-
Save Beelzenef/62f379c39a7f1ea1cfbe6331b102d424 to your computer and use it in GitHub Desktop.
Ejemplo de DbContext con entidades para medium.com/puntotech
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; | |
namespace PuntoTechApp | |
{ | |
public class MyContext : DbContext | |
{ | |
public DbSet<Post> Posts { get; set; } | |
protected override void OnConfiguring(DbContextOptionsBuilder options) | |
{ | |
if (!options.IsConfigured) | |
{ | |
IConfigurationRoot configuration = new ConfigurationBuilder() | |
.Build(); | |
options.UseSqlServer("Server=localhost;Database=PuntoTechApp;Trusted_Connection=True;").EnableSensitiveDataLogging(); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment