I am not sure but you can use annotations but also something as
follows:
public static class BookingManager
{
public static void PlaceBooking(Booking booking)
{
var errors = DataAnnotationsValidationRunner.GetErrors
(booking);
if (errors.Any())
throw new RulesException(errors);
// Business rule: Can't place bookings on Sundays
if(booking.ArrivalDate.DayOfWeek == DayOfWeek.Sunday)
throw new RulesException("ArrivalDate", "Bookings are not
permitted on Sundays", booking);
// Todo: save to database or whatever
}
}
So you can use NHibernate validators as a business rule ... or not?
http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/
Is that what you mean?
On Apr 13, 11:01 pm, Dario Quintana <[email protected]>
wrote:
> I don't know how you're able to use the new features of interpolation of NHV
> with xVal, but repeat, I'm not so sure, investigate. I.e:. Now in NHV you
> can write a custom message like: "The Customer with Id: ${Id} has a Name
> with no valid length: Valid Leng {Min} till {Max}"
>
>
>
> On Mon, Apr 13, 2009 at 4:07 PM, shapper <[email protected]> wrote:
>
> > On Apr 13, 7:20 pm, Dario Quintana <[email protected]>
> > wrote:
> > > Seems like xVal integrate NHV and xVal to use it with Asp.Net MVC, but
> > you
> > > should have a look what is going on in background:
> >https://xval.svn.codeplex.com/svn/RulesProviders/NHibernateValidator/...
>
> > Is it bad? You wrote as a warning ... Something not well done?
>
> > > Seems like is providing client&server side validation for NHV, I should
> > > check this deeper.
>
> > Yes, that is why I am really considering XVal ... it allows me to use
> > Client validation with JQuery which I already use.
>
> > > Also few days ago, I wrote this entry in how to integrate MVC with NHV,
> > this
> > > is just server-side validation, but works fine.
> >http://nhforge.org/blogs/nhibernate/archive/2009/04/02/nhibernate-val...
> > > Suggestions are welcome.
>
> > I found that blog post earlier today.
> > A question: where would you put specific validation not possible with
> > the Class Property Annotations?
>
> > Thanks,
> > Miguel
>
> --
> Dario Quintanahttp://darioquintana.com.ar
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---