Changed models, added Application layer models
This commit is contained in:
		| @@ -2,15 +2,14 @@ | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration; | ||||
|  | ||||
| public class PastVisaConfiguration : IEntityTypeConfiguration<PastVisa> | ||||
| { | ||||
|     public class PastVisaConfiguration : IEntityTypeConfiguration<PastVisa> | ||||
|     public void Configure(EntityTypeBuilder<PastVisa> entity) | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<PastVisa> entity) | ||||
|         { | ||||
|             entity.Property(p => p.Name) | ||||
|                 .IsUnicode(false) | ||||
|                 .HasMaxLength(70); | ||||
|         } | ||||
|         entity.Property(p => p.Name) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(70); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -2,15 +2,14 @@ | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration; | ||||
|  | ||||
| public class PermissionToDestCountryConfiguration : IEntityTypeConfiguration<PermissionToDestCountry> | ||||
| { | ||||
|     public class PermissionToDestCountryConfiguration : IEntityTypeConfiguration<PermissionToDestCountry> | ||||
|     public void Configure(EntityTypeBuilder<PermissionToDestCountry> entity) | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<PermissionToDestCountry> entity) | ||||
|         { | ||||
|             entity.Property(p => p.Issuer) | ||||
|                 .IsUnicode(false) | ||||
|                 .HasMaxLength(200); | ||||
|         } | ||||
|         entity.Property(p => p.Issuer) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(200); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -2,15 +2,14 @@ | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration; | ||||
|  | ||||
| public class ReentryPermitConfiguration : IEntityTypeConfiguration<ReentryPermit> | ||||
| { | ||||
|     public class ReentryPermitConfiguration : IEntityTypeConfiguration<ReentryPermit> | ||||
|     public void Configure(EntityTypeBuilder<ReentryPermit> entity) | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<ReentryPermit> entity) | ||||
|         { | ||||
|             entity.Property(p => p.Number) | ||||
|                 .IsUnicode(false) | ||||
|                 .HasMaxLength(25); | ||||
|         } | ||||
|         entity.Property(p => p.Number) | ||||
|             .IsUnicode(false) | ||||
|             .HasMaxLength(25); | ||||
|     } | ||||
| } | ||||
| } | ||||
| @@ -2,21 +2,22 @@ | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration | ||||
| namespace Infrastructure.Database.VisaApplications.Configuration; | ||||
|  | ||||
| public class VisaApplicationConfiguration : IEntityTypeConfiguration<VisaApplication> | ||||
| { | ||||
|     public class VisaApplicationConfiguration : IEntityTypeConfiguration<VisaApplication> | ||||
|     public void Configure(EntityTypeBuilder<VisaApplication> entity) | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<VisaApplication> entity) | ||||
|         { | ||||
|             entity.ToTable("VisaApplications"); | ||||
|         entity.ToTable("VisaApplications"); | ||||
|  | ||||
|             entity.HasOne(va => va.Applicant) | ||||
|                 .WithMany(a => a.VisaApplications) | ||||
|                 .HasForeignKey(va => va.ApplicantId) | ||||
|                 .IsRequired(); | ||||
|         entity.HasOne(va => va.Applicant) | ||||
|             .WithMany(a => a.VisaApplications) | ||||
|             .HasForeignKey(va => va.ApplicantId) | ||||
|             .IsRequired(); | ||||
|  | ||||
|             entity.OwnsOne(p => p.ReentryPermit); | ||||
|             entity.OwnsOne(p => p.PermissionToDestCountry); | ||||
|         } | ||||
|         entity.OwnsOne(p => p.ReentryPermit); | ||||
|         entity.OwnsOne(p => p.PermissionToDestCountry); | ||||
|         entity.OwnsMany(p => p.PastVisits).ToTable("PastVisits"); | ||||
|         entity.OwnsMany(p => p.PastVisas).ToTable("PastVisas"); | ||||
|     } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user