17 lines
536 B
C#
17 lines
536 B
C#
using Bimix.Domain.Entities;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Bimix.Infrastructure.Data;
|
|
|
|
public class BimixDbContext(DbContextOptions<BimixDbContext> options) : DbContext(options)
|
|
{
|
|
public DbSet<Product> Products { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
modelBuilder.Entity<Product>().HasKey(p => p.Id);
|
|
modelBuilder.Entity<Product>().Property(p => p.Name).IsRequired().HasMaxLength(200);
|
|
}
|
|
} |