I think with this, NHV is going to be more famous :-) Here you can get ideas: http://www.codeplex.com/FluentValidation
BTW, how are you going to treat the "metadata layer", we should discuss this, don't know what plans you have. On Wed, Feb 11, 2009 at 2:26 PM, Fabio Maulo <[email protected]> wrote: > Hi.I'm going to add a new way to map validators trough an implementation > based on fluent-interface. > This will be the 3th kind of embedded configuration: Reflection, XML, FI > The FI is "strogly-typed" as Reflection but it is external (from the point > of view of an entity-implementation) as XML. > > For the ValidatorMode feature I would like to equate FI to Reflection > (XmlOverAttributeClassMapping). > > The API should look like: > > var v = new ValidationDef<Person>(); > v.Define(x=>x.Name).AsNotNull().AsNotEmpty(); > > v.Define(x=>x.Surname).AsNotNull().AsNotEmpty().WithMaxLength(10).WithMinLength(3); > v.Define(x=>x.Assoc).MustBeValid(); > > and/or > > public class PersonValidationDef : ValidationDef<Person> > { > public PersonValidationDef() > { > Define(x=>x.Name).AsNotNull().AsNotEmpty(); > > > Define(x=>x.Surname).AsNotNull().AsNotEmpty().WithMaxLength(10).WithMinLength(3); > Define(x=>x.Assoc).MustBeValid(); > } > } > > Validators available will be strongly-typed that mean, for example, that > giving a DateTime property (DateTime or DateTime?) only 2 validators will be > available > var v = new ValidationDef<Person>(); > v.Define(x=>x.BornDate). here you will see only IsInThePast > and IsInTheFuture > > Obviously each one may implements his extension methods. > > Thoughts? > -- > Fabio Maulo > > > > -- Dario Quintana http://darioquintana.com.ar --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "NHibernate Contrib - Development Group" 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.ar/group/nhcdevs?hl=en -~----------~----~----~----~------~----~------~--~---
