Initial commit: project structure, bez lokalnych secrets
This commit is contained in:
17
Bimix.Infrastructure/Data/BimixDbContext.cs
Normal file
17
Bimix.Infrastructure/Data/BimixDbContext.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user