我不是一个有经验的程序员。我总是浏览源代码来学习一些东西。ASP.NET Boilerplate 是我最喜欢的一个。昨天,我注意到有友谊应用服务(在服务/应用层)和友谊管理器(在业务/领域层)。我不明白为什么会有友谊经理。友情服务还不够?
public interface IFriendshipAppService : IApplicationService
{
Task<FriendDto> CreateFriendshipRequest(CreateFriendshipRequestInput input);
Task<FriendDto> CreateFriendshipRequestByUserName(CreateFriendshipRequestByUserNameInput input);
void BlockUser(BlockUserInput input);
void UnblockUser(UnblockUserInput input);
void AcceptFriendshipRequest(AcceptFriendshipRequestInput input);
}
public interface IFriendshipManager : IDomainService
{
void CreateFriendship(Friendship friendship);
void UpdateFriendship(Friendship friendship);
Friendship GetFriendshipOrNull(UserIdentifier user, UserIdentifier probableFriend);
void BanFriend(UserIdentifier userIdentifier, UserIdentifier probableFriend);
void AcceptFriendshipRequest(UserIdentifier userIdentifier, UserIdentifier probableFriend);
}