Where to place the service level

I am using the FluentValidation framework. And at the moment I have several validators (for each object). I save the objects in a separate assembly ( ProjectName.Domain ) and validators.

I read about the service level that the intermediary layer between repositories and controllers represents ( http://www.asp.net/mvc/tutorials/older-versions/models-(data)/validating-with-a-service-layer-cs ) Is it possible to keep the service layer in the same assembly?

As far as I understand, the goal of the service level is to have a specific (or possibly common) repository and an appropriate validator, as well as check the correctness of the repository elements. Thus, implementations may vary. I'm right?

How to make a service layer using FluentValidation (or independent of the framework) in the right way. Or it would be acceptable to integrate the base object with some FluentValidation AbstractValidator class .

Thanks!

+4
source share
1 answer

separating layers do not require physically separate assemblies. in fact, the more builds you have, the more difficult / cumbersome to manage the solution. separating layers are a logical task. it may be separated by a namespace or naming convention.

As far as I understand the purpose of service layer is to hold concrete (or possibly generic) repository and corresponding validator and make a validation over repository items. So implementations may vary. Am I right?

which can be used for the service level, but this is not necessary. The term β€œservices” has become over-used in the past few years to the point that it means almost nothing.

The goal of bundling your application is to allow the application to adapt to change. this is a very vague expression, but all he did. layers allow you to encapsulate and encapsulate allows you to change.

+4
source

Source: https://habr.com/ru/post/1388286/


All Articles