I'm experimenting with some projects at the moment and I am stuck trying to decide on the correct approach to this question.
Given a simple architecture like this consisting of
Domain - (Person and IPersonService)
public class Person
{
public string Name { get; set; }
public string PhoneNumber { get; set; }
public string ImageUrl { get; set; }
}
public interface IPersonService
{
void Save(Person person);
Person GetById(string id);
}
Infrastructure - (PersonService) -> Database
public class PersonService
{
void Save(Person person)
{
//Save to DB
}
Person GetById(string id)
{
return //FROM DB
}
}
UI
There is now a requirement to allow the user to search for an image with some UX around it , select an image and we populate the imageUrl on the Person record. The imageservice will be a server side http call to some thirdparty image API which we will then return to our UI.
My question is where should this IImageService live?
To me it doesn't make sense to live in the Domain because the domain doesn't care about it. Although it could.
The ImageService is going to require some additional models etc too.
Do these all live in the Infrastructure or UI? Or do we need an additional project UI.Services?
I may be overthinking it but just curious what others think.