Enterprise library Validation block versus FluentValidation

On the current code I’m working on, I wanted to use Enterprise library validation block (EntLibVal) but I ended up with Fluent validation (FV) to validate my input. I settled on the latter for the the former was causing me headaches in the following manner:

  • Configuration using the “Enterprise configuration console” was buggy in my opinion. I had created a custom validator and when it came to its configuration, I didn’t get the option to load my custom validator however much I tried loading the appropriate dll. I wanted this to work so that I didn’t have to pollute my domain class with data annotation.
  • As a result, I had to begrudgingly resort to using data annotations but that really polluted my class which I didn’t really like.
  • The deal breaker for me was how difficult it was to try and use Castle Windsor as my IoC container (EntLibVal comes with Unity as the default IoC). That proved to be the straw that broke the camel’s back.
    • Although there is supposed to be a Castle Windsor extension, unfortunately the latter is using an older version of Castle Windsor (2.5.1) (I was using 3.2.0). That means you will run into the following problem. Once you get past that hurdle using the solution provided in the SO post, you then run into a problem with the implementation of the extension. The solution might be to look at this project and maybe to implement your own instance of IContainerConfigurator. In my opinion, this is way too much ceremony just to use another IoC container.
  • To get started with EntLibVal is well documented but to do more involved things e.g. using a different IoC container, was just plain undocumented.

So I then settled on FV and I did what I had to do in 30 minutes whereas I spent the best part of two days not really getting to where I wanted to be at using EntLibVal. The latter is not a bad product but there was too much faffing around to my liking and I really have better things to do than to try and understand the internals of the EntLibVal.

Posted in .NET, Enterprise Library Validation Block, FluentValidation

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Enter your email address to subscribe to this blog and receive notifications of new posts by email.

Join 3 other followers

April 2013
« Mar   May »
%d bloggers like this: