| 123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- using GreenTree.Strohrmann.ERP.Core.Domain.Business;
- using Microsoft.EntityFrameworkCore;
- using Microsoft.EntityFrameworkCore.Metadata.Builders;
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace GreenTree.Strohrmann.ERP.Domain.Model.Business
- {
- public class CustomerMapping : IEntityTypeConfiguration<Customer>
- {
- public void Configure(EntityTypeBuilder<Customer> builder)
- {
- builder.ToTable("Customers");
- builder.HasKey(u => u.Id);
- builder.Property(u => u.Id)
- .ValueGeneratedOnAdd();
- builder.Property(u => u.Firstname)
- .IsRequired();
- builder.Property(u => u.Lastname)
- .IsRequired();
- builder.Property(u => u.Address)
- .IsRequired();
- builder.Property(u => u.Town)
- .IsRequired();
- builder.Property(u => u.ZipCode)
- .IsRequired();
- builder.Property(u => u.Country)
- .IsRequired();
- builder.HasOne(u => u.Tax)
- .WithMany(d => d.Customers)
- .IsRequired()
- .OnDelete(DeleteBehavior.Restrict);
- }
- }
- }
|