Both classes below implement the same interface and are in fact intended to be interchangeable one for the other. Why is the second one not referred to as a "client" in the literature?
There are many references to service layers, repositories, etc.:
How essential is it to make a service layer?
https://www.asp.net/mvc/overview/older-versions-1/models-data/validating-with-a-service-layer-cs
This is a WebAPI client. We see the same pattern with WCF client, etc.
namespace Application.WebAPIClient
{
public class UsersClient : BaseClient, IUsersService
{
public async Task<int> SaveUser(User user)
{
string json = JsonConvert.SerializeObject(user);
StringContent content = new StringContent(json, System.Text.Encoding.UTF8, "application/json");
HttpResponseMessage msg = await httpClient.PostAsync("users/saveuser", content);
return Convert.ToInt32(await msg.Content.ReadAsStringAsync());
}
}
}
Why is the following not a "LAN client" or some other kind of client? Often called Repository or Service but never client although it wraps a call to sqlClient just as the code above wraps a call to HttpClient.
namespace Application.Repository
{
public class UsersRepository : BaseService, IUsersService
{
// ...
public async Task<int> SaveUser(User user)
{
db.Users.Add(user);
await db.SaveChangesAsync();
return user.ID;
}
}
}