diff --git a/2. Services/2.2 Processings/2.2 Processings.md b/2. Services/2.2 Processings/2.2 Processings.md index cd78d1a..8d644c5 100644 --- a/2. Services/2.2 Processings/2.2 Processings.md +++ b/2. Services/2.2 Processings/2.2 Processings.md @@ -12,7 +12,7 @@ Here's an example of what a Processing service function would look like: public ValueTask UpsertStudentAsync(Student student) => TryCatch(async () => { - ValidateStudent(student); + ValidateStudentOnUpert(student); IQueryable allStudents = this.studentService.RetrieveAllStudents(); @@ -21,7 +21,7 @@ TryCatch(async () => retrievedStudent.Id == student.Id); return studentExists switch { - false => await this.studentService.RegisterStudentAsync(student), + false => await this.studentService.AddStudentAsync(student), _ => await this.studentService.ModifyStudentAsync(student.Id) }; }); @@ -106,7 +106,7 @@ Processing services delegate full validations to the layer of services that are public ValueTask UpsertStudentAsync(Student student) => TryCatch(async () => { - ValidateStudent(student); + ValidateStudentOnUpsert(student); IQueryable allStudents = this.studentService.RetrieveAllStudents(); @@ -115,13 +115,13 @@ TryCatch(async () => retrievedStudent.Id == student.Id); return isStudentExists switch { - false => await this.studentService.RegisterStudentAsync(student), + false => await this.studentService.AddStudentAsync(student), _ => await this.studentService.ModifyStudentAsync(student.Id) }; }); ``` -Processing services are also not very concerned about outgoing validations except for what they will use within the same routine. For instance, if a Processing service is retrieving a model and will use this model to be passed to another primitive-level function on the Foundation layer, the Processing service will be required to validate that the retrieved model is valid, depending on which attributes of the model it uses. +Processing services are also not very concerned about outgoing validations except for what they will use within the same routine. Some exceptions may be neccesary as discussed in later sections. For instance, if a Processing service is retrieving a model and will use this model to be passed to another primitive-level function on the Foundation layer, the Processing service will be required to validate that the retrieved model is valid, depending on which attributes of the model it uses. However, processing services will delegate the outgoing validation to the foundation layer for Pass-through scenarios. ## 2.2.3 Responsibilities @@ -141,6 +141,8 @@ For instance, in a shifter pattern, we want to verify whether a student exists. public ValueTask VerifyStudentExists(Guid studentId) => TryCatch(async () => { + ValidateStudentId(studentId); + IQueryable allStudents = this.studentService.RetrieveAllStudents();