[英]What is difference between a service Layer and Business Layer in N layered architecture
What is difference between a service Layer and Business Layer in N layered architecture N层架构中的服务层和业务层之间有什么区别
I am building N layered application, so I have gone through many resources on N layered architectures which contain layers such as a service layer egs https://prodinner.codeplex.com/ 我正在构建N层应用程序,因此我遍历了N层体系结构上的许多资源,这些体系结构包含诸如服务层之类的层,例如https://prodinner.codeplex.com/
a service class in the above project 上述项目中的服务类别
public class UserService : CrudService<User>, IUserService
{
private readonly IHasher hasher;
public UserService(IRepo<User> repo, IHasher hasher)
: base(repo)
{
this.hasher = hasher;
hasher.SaltSize = 10;
}
public override int Create(User user)
{
user.Password = hasher.Encrypt(user.Password);
return base.Create(user);
}
public bool IsUnique(string login)
{
return !repo.Where(o => o.Login == login, true).Any();
}
}
So is the traditional business layer same as service layer ? 那么传统业务层与服务层是否相同?
The basic difference is Business Layer is to define business logic ( data transformation ) and Service Layer is to access data from different client's. 基本区别在于,业务层用于定义业务逻辑(数据转换),服务层用于访问来自不同客户端的数据。 In our projects we often have the following structure:
在我们的项目中,我们通常具有以下结构:
Service layer: 服务层:
Publishes the Service Endpoint (this could be your MVC web page, or a WCF endpoint) Does a security check Maps data from contract data transfer objects to business objects Calls functionality in the business layer 发布服务端点(这可能是您的MVC网页或WCF端点)是否进行安全检查将数据从合同数据传输对象映射到业务对象调用业务层中的功能
Business layer 业务层
Contains business logic Accesses the data layer (this could be your entity framework data model) 包含业务逻辑访问数据层(这可能是您的实体框架数据模型)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.