Skip to content

Instantly share code, notes, and snippets.

@juniormayhe
Last active September 5, 2020 19:20
Show Gist options
  • Save juniormayhe/e9b22c294243632034b7eefb31a02b44 to your computer and use it in GitHub Desktop.
Save juniormayhe/e9b22c294243632034b7eefb31a02b44 to your computer and use it in GitHub Desktop.
Contextos
using Entidades.Modelo;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace Proyecto
{
public class MiClaseParaDatosContext : DbContext
{
public MiClaseParaDatosContext(DbContextOptions<MiClaseParaDatosContext> options) : base(options)
{
}
public DbSet<Product> Products { get; set; }
public DbSet<ProductBrand> ProductBrands { get; set; }
public DbSet<ProductType> ProductTypes { get; set; }
public DbSet<Order> Orders { get; set; }
public DbSet<OrderItem> OrderItems { get; set; }
public DbSet<DeliveryMethod> DeliveryMethods { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
modelBuilder.ApplyConfigurationsFromAssembly(Assembly.GetExecutingAssembly());
}
}
using Entidades.ModeloIdentity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace Proyecto
{
public class MiClaseParaIdentityContext : IdentityDbContext<AppUser>
{
public MiClaseParaIdentityContext(DbContextOptions<MiClaseParaIdentityContext> options) : base(options)
{
}
protected override void OnModelCreating(ModelBuilder builder)
{
base.OnModelCreating(builder);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment