Enterprise Library Validation Blocks

I just started using ms check blocks, which in my opinion are awesome. but there are a few questions regarding data validation between layers.

I am currently using the repository template as a bridge for my data access level. In my logical layer, I populate my business object and then test the use of the validation block before passing it to my repository level, which in turn transfers it to the data access level for insertion. Should I check it again in the repository? If so, am I checking block usage again, or is there a better way to do this at this level?

+8
c # validation architecture enterprise-library
source share
1 answer

As long as you use a layered architecture where all calls to the repository go through the business layer, you do not need to check it again in the repository.

However, if the repository is used by other systems that do not pass through your business layer, you need to check it at the repository level.

But this actually violates the principle of DRY Do not Repeat Yourself.

Therefore, if you need to check in the repository, you also should not do this at the business level.

+3
source share

All Articles