领域中的一些概念不太适合建模为对象,即归类到实体对象或值对象,因为它们本质上就是一些操作,一些动作,而不是事物。
public partial interface IRoleService { Setting GetRoleById(int roleId); }
实现IRoleService
public partial class RoleService : IRoleService { private readonly IRepository<Role> _roleRepository; private readonly ICacheManager _cacheManager; public RoleService(ICacheManager cacheManager,IRepository<Role> roleRepository) { this._cacheManager = cacheManager; this._roleRepository = roleRepository; } public Setting GetRoleById(int roleId) { return _roleRepository.GetById(roleId); } }
使用RoleService
var server = RF.Service<IRoleService>();