Fixed configurations of owned types
This commit is contained in:
		| @@ -1,18 +1,23 @@ | ||||
| using Domains.ApplicantDomain; | ||||
| using Domains; | ||||
| using Domains.ApplicantDomain; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.Applicants.Configuration; | ||||
|  | ||||
| public class AddressConfiguration : IEntityTypeConfiguration<Address> | ||||
| public static class AddressConfiguration<T> where T : class, IEntity | ||||
| { | ||||
|     public void Configure(EntityTypeBuilder<Address> entity) | ||||
|     public static void Configure(OwnedNavigationBuilder<T, Address> entity) | ||||
|     { | ||||
|         entity.HasOne(a => a.Country).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|         entity.HasOne(a => a.City).WithMany().OnDelete(DeleteBehavior.Restrict); | ||||
|  | ||||
|         entity.Property(p => p.Street) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(100); | ||||
|  | ||||
|         entity.Property(p => p.Building) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(10); | ||||
|     } | ||||
| } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user