﻿<?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>Colin Jack commented on NHibernate Validator</title><description>"Of the top of my head, I don't think that you can implement an interface, mostly because it hurt the poconess of the class"
  
  
I see what you are saying, but I consider a lot of validation to be a domain concern, so I want the option of having an object *controlling* many aspects of its own validation (its won invariants in particular).
</description><link>http://ayende.com/3990/nhibernate-validator#comment17</link><guid>http://ayende.com/3990/nhibernate-validator#comment17</guid><pubDate>Wed, 06 May 2009 09:31:31 GMT</pubDate></item><item><title>Peter Morris commented on NHibernate Validator</title><description>Hi Ayende
  
  
Oh I understand the misunderstanding between us now :-)  Maybe it would be better if I had written
  
  
"I presume there is some kind of interface *SOME VALIDATION* class can implement to return broken constraints or something?"
  
  
By this I mean that instead of writing a .NET attribute class which performs a single validation, for the complex rules I would write something like
  
  
public class Validator
&lt;person  
{
  
}
  
  
or
  
  
public class PersonValidator : IValidator
&lt;person  
{
  
}
  
  
Where all validation rules may be added?  The big problem with validation though is when a rule depends upon private state.
  
  
private string password;
  
public string Password
  
{
  
  set { password = value; }
  
}
  
  
I presume the validator attribute may also be applied to a private member?
  
  
Cheers :-)
  
  
  
Pete
&gt;</description><link>http://ayende.com/3990/nhibernate-validator#comment16</link><guid>http://ayende.com/3990/nhibernate-validator#comment16</guid><pubDate>Sat, 02 May 2009 10:34:28 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Peter,
  
It creates a dependency between the class and the framework, that breaks POCO
  
And while NH has such interfaces, they are considered deprecated, and their use is frowned upon.
  
  
</description><link>http://ayende.com/3990/nhibernate-validator#comment15</link><guid>http://ayende.com/3990/nhibernate-validator#comment15</guid><pubDate>Sat, 02 May 2009 10:07:29 GMT</pubDate></item><item><title>Peter Morris commented on NHibernate Validator</title><description>Adding an interface to a class to return a list of errors is still POCO in my opinion.  NH has call back interface options for classes doesn't it?  That isn't considered breaking the POCOness, or is it?
  
  
I like the look of the validator, but without the ability to have the class itself define more complicated invariants you'll end up writing a class per rule which can only be used on a specific entity type.  In addition to that you sometimes need to access private state in order to validate.
  
  
I posted a comment on that blog you linked to but it hasn't been approved yet, we'll see if it does or not :-)
</description><link>http://ayende.com/3990/nhibernate-validator#comment14</link><guid>http://ayende.com/3990/nhibernate-validator#comment14</guid><pubDate>Sat, 02 May 2009 07:13:13 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Peter,
  
Of the top of my head, I don't think that you can implement an interface, mostly because it hurt the poconess of the class
  
  
</description><link>http://ayende.com/3990/nhibernate-validator#comment13</link><guid>http://ayende.com/3990/nhibernate-validator#comment13</guid><pubDate>Sat, 02 May 2009 05:51:47 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>If you want to know from technical perspective, NHV will intercept the schema generation and add the validation to the schema itself
</description><link>http://ayende.com/3990/nhibernate-validator#comment12</link><guid>http://ayende.com/3990/nhibernate-validator#comment12</guid><pubDate>Fri, 01 May 2009 21:23:15 GMT</pubDate></item><item><title>eledu commented on NHibernate Validator</title><description>oops, the column element 
</description><link>http://ayende.com/3990/nhibernate-validator#comment11</link><guid>http://ayende.com/3990/nhibernate-validator#comment11</guid><pubDate>Fri, 01 May 2009 18:44:17 GMT</pubDate></item><item><title>eledu commented on NHibernate Validator</title><description>How this relate to the 
&lt;column element when generating schemas.
&gt;</description><link>http://ayende.com/3990/nhibernate-validator#comment10</link><guid>http://ayende.com/3990/nhibernate-validator#comment10</guid><pubDate>Fri, 01 May 2009 18:42:50 GMT</pubDate></item><item><title>Peter Morris commented on NHibernate Validator</title><description>I wouldn't want to write a custom class for something like A &lt; B.  I presume there is some kind of interface the class can implement to return broken constraints or something?
  
  
I'll ask the guy who wrote the blog entry you posted a link to :-)
</description><link>http://ayende.com/3990/nhibernate-validator#comment9</link><guid>http://ayende.com/3990/nhibernate-validator#comment9</guid><pubDate>Fri, 01 May 2009 15:46:42 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Merritt,
  
And in the same vain, you write a custom validator. There are docs about doing just that, and you can also look here:
  
[msmvps.com/.../...he-code-with-external-rules.aspx](http://msmvps.com/blogs/luisabreu/archive/2009/04/26/nhibernate-validator-improving-the-code-with-external-rules.aspx)</description><link>http://ayende.com/3990/nhibernate-validator#comment8</link><guid>http://ayende.com/3990/nhibernate-validator#comment8</guid><pubDate>Fri, 01 May 2009 15:18:42 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Bryan,
  
I am not going to touch on that. Validation framework design is not something that I did.
  
I can comment on that it seems workable to invalidate one of them or to create two error messages, and that adding that would significantly complicate the design of most other scenarios.
  
And yes, this is a port of a Java project, there is no need to reinvent the wheel if it is already there and moving.
</description><link>http://ayende.com/3990/nhibernate-validator#comment7</link><guid>http://ayende.com/3990/nhibernate-validator#comment7</guid><pubDate>Fri, 01 May 2009 15:16:48 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Sarong,
  
I am not going to get into that. The main benefit of NHV is that it ties strongly into NH.
  
  
</description><link>http://ayende.com/3990/nhibernate-validator#comment6</link><guid>http://ayende.com/3990/nhibernate-validator#comment6</guid><pubDate>Fri, 01 May 2009 15:14:16 GMT</pubDate></item><item><title>Ayende Rahien commented on NHibernate Validator</title><description>Peter,
  
Then you create a custom validator.
</description><link>http://ayende.com/3990/nhibernate-validator#comment5</link><guid>http://ayende.com/3990/nhibernate-validator#comment5</guid><pubDate>Fri, 01 May 2009 15:12:13 GMT</pubDate></item><item><title>Merritt commented on NHibernate Validator</title><description>About 6 months ago, I invested several days looking into this framework and was very impressed. 
  
  
Since I am a bit rusty  on the details, I was hoping you could remind how one would use this framework to do validation based on property comparisons. For instance, say property A is only valid in a certain range and that range depends on the value of property B. Typically I have done such validation with declarative/attribute based validation frameworks within the body of a function, and somehow hooking that function into the validation process. 
  
  
This question is in the same vain as Peter Morris' 
</description><link>http://ayende.com/3990/nhibernate-validator#comment4</link><guid>http://ayende.com/3990/nhibernate-validator#comment4</guid><pubDate>Fri, 01 May 2009 14:53:50 GMT</pubDate></item><item><title>Bryan commented on NHibernate Validator</title><description>One validation message needs the ability to invalidate multiple property names.  
  
  
Example:  A must be greater than B
  
  
It's one rule.  It invalidates both A and B, but it's still only one rule and should ultimately display only a single error message.
  
  
I see this again and again in every validation framework and it drives me mad.
  
  
Secondly, is this another direct port from Java?  I see references like "beanName" all over the source code.  I thought we'd finally moved beyond this in the .NET world and were able to stand on our own?
</description><link>http://ayende.com/3990/nhibernate-validator#comment3</link><guid>http://ayende.com/3990/nhibernate-validator#comment3</guid><pubDate>Fri, 01 May 2009 14:41:34 GMT</pubDate></item><item><title>sarong commented on NHibernate Validator</title><description>for the last project i evaluated it, but compared to castle validator its harder to extend, cause di doesn't work nice. what are your thoughts when comparing it with castle validator?
</description><link>http://ayende.com/3990/nhibernate-validator#comment2</link><guid>http://ayende.com/3990/nhibernate-validator#comment2</guid><pubDate>Fri, 01 May 2009 11:44:37 GMT</pubDate></item><item><title>Peter Morris commented on NHibernate Validator</title><description>A nice start :-)
  
  
How would you add validation which cannot be expressed as a .NET attribute.  For example an invariant which is based on an object's state.
  
  
"Signature required if the order.Status == OrderStatus.Approved"
  
  
  
</description><link>http://ayende.com/3990/nhibernate-validator#comment1</link><guid>http://ayende.com/3990/nhibernate-validator#comment1</guid><pubDate>Fri, 01 May 2009 09:51:03 GMT</pubDate></item></channel></rss>