﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Paul Kohler commented on The IoC mind set: Validation</title><description>Thats one nice, simple but very flexible solution. I like it! Good cobination of Castle features...
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment15</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment15</guid><pubDate>Thu, 25 Oct 2007 12:00:41 GMT</pubDate></item><item><title>Liviu commented on The IoC mind set: Validation</title><description>I have built experimentally a validation framework where exactly ORDER was handled well, but things get complex very soon.
  
The fwk will parse the code and detect dependencies between validation methods and invoke them in the "logical" order...
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment14</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment14</guid><pubDate>Thu, 25 Oct 2007 11:53:40 GMT</pubDate></item><item><title>stiven commented on The IoC mind set: Validation</title><description>Thanks for the pointers to the articles
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment13</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment13</guid><pubDate>Wed, 24 Oct 2007 15:06:58 GMT</pubDate></item><item><title>Steve Campbell commented on The IoC mind set: Validation</title><description>I have used a similar scheme before for validation.  While it worked really well, the one downside was that it was difficult to prioritize the validation results.  
  
  
For example, one validation may fail because something is missing, and then another validation fail for the same basic reason, but a different symptom.  
  
  
No easy, maintainable solution, because each isolated validation does not have sufficient information to prioritize itself over others. 
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment12</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment12</guid><pubDate>Tue, 23 Oct 2007 20:34:31 GMT</pubDate></item><item><title>Steven R commented on The IoC mind set: Validation</title><description>Darius,
  
  
The type is registered in the container so when the validator of type book is requested the container will return the correct service to validate a book.
  
  
Here is an example:
  
  
&lt;component id="book.validator"
  
service="Example.IValidator`1[[Example.Book, Example]], Example"
  
type="Example.Validator`1[[Example.Book, Example]], Example"&gt;
  
&lt;/component&gt;
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment11</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment11</guid><pubDate>Tue, 23 Oct 2007 04:24:07 GMT</pubDate></item><item><title>Ricardo Stuven commented on The IoC mind set: Validation</title><description>@Stiven,
  
See also Alex Henderson's tutorial series:
  
  
http://wiki.bittercoder.com/(X(1)S(3hr4rlju4pqj2o3iyaxxre45))/ContainerTutorials.ashx
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment10</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment10</guid><pubDate>Tue, 23 Oct 2007 03:54:51 GMT</pubDate></item><item><title>Tuna Toksoz commented on The IoC mind set: Validation</title><description>even though you ask the question to oren, 
  
i would like to answer it 
  
  
http://msdn2.microsoft.com/en-us/library/aa973811.aspx
  
  
This is a great article written by Oren. Uses windsor in implementation. A sample is far omre better than theory so you'll gain a lot from this article.
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment9</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment9</guid><pubDate>Mon, 22 Oct 2007 15:29:30 GMT</pubDate></item><item><title>Stiven commented on The IoC mind set: Validation</title><description>Oren
  
Any tips on the best place to start to learn about IoC. 
  
Books, websites, sample apps....?
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment8</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment8</guid><pubDate>Mon, 22 Oct 2007 12:18:30 GMT</pubDate></item><item><title>Andris Kurmis commented on The IoC mind set: Validation</title><description>Wouldn't kernel.GetHandlers require that the IValidatorOf&lt;&gt; service type is set for all the validation components? So, assuming that one uses Binsor, there would be a separate reflection loop or condition that registers validators using this specific interface?
  
  
Can kernel.GetAssignableHandlers be used instead, so one would not have to distinct validation components from others in configuration file? Or there is a significant overhead in GetAssignableHandlers?
  
  
And another thought about a situation when there are many business classes that derive from some (abstract) base class, and there are some validations that apply to this base class. Then one can introduce an inner loop for getting validators for base types as well.
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment7</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment7</guid><pubDate>Mon, 22 Oct 2007 10:07:49 GMT</pubDate></item><item><title>Markus Zywitza commented on The IoC mind set: Validation</title><description>Darius, 
  
isn't that part of the Validation logic? I would implement that as part of the specific validation rule, not of the Validator.
  
  
Business actions IMO completely unrelated to validation. The main difference is that validation is applied after changes only. Model data is expected to remain valid once it was successfully validated and invalid data will not be saved. 
  
Workflows (or business actions) are not only applied when data is changed. They might be applied anytime, by any other component or subsystem. Such actions can make data become invalid without changing it. 
  
The only thing that's similar is that both validation rules and workflow items can be stored in similar manner in an IoC-Container.
  
  
  -Markus
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment6</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment6</guid><pubDate>Mon, 22 Oct 2007 08:54:54 GMT</pubDate></item><item><title>Darius Damalakas commented on The IoC mind set: Validation</title><description>A nice idea.
  
How about turning on and off validation rules depending on the state of the object, and on the actions of user?
  
  
Some examples:
  
If product type is "book", then ISBN field is required, otherwise it is not required. 
  
If product type is "car", then engine number is required, otherwise it's not required.
  
  
These are very simple examples, there are much more interesting than thse :)
  
  
  
  
  
Another interesting topic very much related to busines rules are bussiness actions. Say, we have a form for managing a ticket. Now what bussiness would want to have is if ticket type is "feature request", and if this ticket status is still "not approved" for two weeks, then send an email to the author of the ticket, and to the head of help desk department.
  
Personally, i see this very related to validation rules.
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment5</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment5</guid><pubDate>Mon, 22 Oct 2007 04:35:49 GMT</pubDate></item><item><title>Glenn Block commented on The IoC mind set: Validation</title><description>In VAB you can do this by using the self-validation capability. You can flag an attribute on a method that has logic to perform the cross property / business validation. Whenever you create a validator for that type it will automatically invoke the self validation method.
  
  
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment4</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment4</guid><pubDate>Mon, 22 Oct 2007 01:49:46 GMT</pubDate></item><item><title>Ayende Rahien commented on The IoC mind set: Validation</title><description>Jan,
  
There are rarely reuse in those cases, because the situation is usually unique.
  
But a base class would do the job just fine.
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment3</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment3</guid><pubDate>Sun, 21 Oct 2007 19:02:51 GMT</pubDate></item><item><title>Tomas Restrepo commented on The IoC mind set: Validation</title><description>This is an interesting discussion. I think that maybe part of the issue that crops up is how we name things. Clearly, the input validation that the Castle Validators and the VAB handle is a completely different beast than the "validation of business rules" you speak of.
  
  
So, how about we don't call both "validations" in the first place? To me, the second scenario you present could be more accurately described as "Enforcing Business Constraints". 
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment2</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment2</guid><pubDate>Sun, 21 Oct 2007 18:57:16 GMT</pubDate></item><item><title>Jan Van Ryswyck commented on The IoC mind set: Validation</title><description>Really nice approach. One stupid question though: how do you reuse validation logic between validators? Suppose you have duplicate validation code in two or more validator classes.  Do you use Specification classes for this, and then use these specifications in the validators?
</description><link>http://ayende.com/2888/the-ioc-mind-set-validation#comment1</link><guid>http://ayende.com/2888/the-ioc-mind-set-validation#comment1</guid><pubDate>Sun, 21 Oct 2007 18:50:59 GMT</pubDate></item></channel></rss>