0
0
RhSolutions-Api/RhSolutions.Api/Models/RhsolutionsContext.cs

22 lines
627 B
C#
Raw Normal View History

2022-12-14 09:53:10 +03:00
using Microsoft.EntityFrameworkCore;
2023-05-11 07:55:26 +03:00
namespace RhSolutions.Models;
2022-12-14 09:53:10 +03:00
public class RhSolutionsContext : DbContext
{
public RhSolutionsContext(DbContextOptions<RhSolutionsContext> options)
2023-05-11 07:55:26 +03:00
: base(options) { }
2022-12-14 09:53:10 +03:00
public DbSet<Product> Products => Set<Product>();
2023-05-11 07:55:26 +03:00
protected override void OnModelCreating(ModelBuilder builder)
{
builder.Entity<Product>()
.Property(e => e.ProductSku)
.HasConversion(v => v.ToString(), v => new ProductSku(v));
2023-12-30 14:43:25 +03:00
// builder.Entity<Product>()
// .Property(e => e.DeprecatedSkus)
// .HasPostgresArrayConversion<ProductSku, string>(v => v.ToString(), v => new ProductSku(v));
2023-05-11 07:55:26 +03:00
}
2022-12-14 09:53:10 +03:00
}