I am building an application that has the following layers
Data – Entity Framework Context
Entities – Entity Framework POCO objects
Service – Called by WebApi to load/save entity
WebApi –
Now i believe that i should put my business logic into the Service layer, as i have a service for entities, for example, i have Family object and a Family Service.
To create a validation object using FluentValidation, it seems that you must inherit from AbstractValidator, since my services already inherit from an object this isnt possible (or is it)?
I guess my only option is to create a FamilyValidator in the service layer and call this validator from within the service?
Is fluentValidation my best option, or am i confusing things here?
Best Answer
If you have an entity called Customer, this is how you write a validator for it: