Fixed configurations of owned types
This commit is contained in:
		| @@ -1,7 +1,6 @@ | ||||
| using ApplicationLayer.Locations; | ||||
| using ApplicationLayer.Locations.NeededServices; | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
| using Infrastructure.Database.Locations.Repositories.Cities.Exceptions; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Cities; | ||||
| @@ -13,12 +12,4 @@ public sealed class CitiesRepository(IGenericReader reader, IGenericWriter write | ||||
|     { | ||||
|         return base.LoadDomain().Include(c => c.Country); | ||||
|     } | ||||
|  | ||||
|     ///<inheritdoc cref="ICitiesRepository.GetByNameAsync"/> | ||||
|     /// <exception cref="CityNotFoundByNameException">city with provided name and country not found</exception> | ||||
|     public async Task<City> GetByNameAsync(string name, string countryName, CancellationToken cancellationToken) | ||||
|     { | ||||
|         var result = await LoadDomain().Where(c => c.Name == name && c.Country.Name == countryName).SingleOrDefaultAsync(cancellationToken); | ||||
|         return result ?? throw new CityNotFoundByNameException(name, countryName); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,11 +0,0 @@ | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.GeneralExceptions; | ||||
|  | ||||
| namespace Infrastructure.Database.Locations.Repositories.Cities.Exceptions | ||||
| { | ||||
|     /// Exception to throw when city cannot be found by its name and its country name | ||||
|     /// <param name="name">Name of the city</param> | ||||
|     /// <param name="countryName">name of the city's country</param> | ||||
|     public class CityNotFoundByNameException(string name, string countryName) | ||||
|         : EntityNotFoundException<City>($"{name} with country {countryName} not found."); | ||||
| } | ||||
| @@ -1,4 +1,4 @@ | ||||
| using ApplicationLayer.Locations; | ||||
| using ApplicationLayer.Locations.NeededServices; | ||||
| using Domains.LocationDomain; | ||||
| using Infrastructure.Database.Generic; | ||||
| using Microsoft.EntityFrameworkCore; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user