Changed domains, configured links between VisaApplication and Applicant,created generic repository and repositories for domains
This commit is contained in:
		| @@ -0,0 +1,16 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Configuration | ||||
| { | ||||
|     public class CityConfiguration : IEntityTypeConfiguration<City> | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<City> entity) | ||||
|         { | ||||
|             entity.Property(p => p.Name) | ||||
|                 .IsUnicode(false) | ||||
|                 .HasMaxLength(70); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,16 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
| using Microsoft.EntityFrameworkCore.Metadata.Builders; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Configuration | ||||
| { | ||||
|     public class CountryConfiguration : IEntityTypeConfiguration<Country> | ||||
|     { | ||||
|         public void Configure(EntityTypeBuilder<Country> entity) | ||||
|         { | ||||
|             entity.Property(p => p.Name) | ||||
|                 .IsUnicode(false) | ||||
|                 .HasMaxLength(70); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,15 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Cities | ||||
| { | ||||
|     public class CitiesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||
|         : GenericRepository<City>(writer, unitOfWork), ICitiesRepository | ||||
|     { | ||||
|         protected override IQueryable<City> LoadDomain() | ||||
|         { | ||||
|             return reader.GetAll<City>().Include(c => c.Country); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Cities | ||||
| { | ||||
|     public interface ICitiesRepository : IGenericRepository<City> { } | ||||
| } | ||||
| @@ -0,0 +1,15 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Countries | ||||
| { | ||||
|     public class CountriesRepository(IGenericReader reader, IGenericWriter writer, IUnitOfWork unitOfWork) | ||||
|         : GenericRepository<Country>(writer, unitOfWork), ICountriesRepository | ||||
|     { | ||||
|         protected override IQueryable<Country> LoadDomain() | ||||
|         { | ||||
|             return reader.GetAll<Country>().Include(c => c.Cities); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| @@ -0,0 +1,7 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Countries | ||||
| { | ||||
|     public interface ICountriesRepository : IGenericRepository<Country> { } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user