I'll sent you a "Common.Validator"... after that dynproxy.The entity
shouldn't be aware your UX needs.

2009/8/20 José F. Romaniello <jfromanie...@gmail.com>

>
> I think that will be interesting to share this code before I drop.
>
> If you are looking for an easy way to hang nhibernate validator to
> work with wpf:
>
>    public class Album : IDataErrorInfo
>    {
>         //properties.
>
>        string IDataErrorInfo.this[string columnName]
>        {
>            get
>            {
>                string[] messages =
> _validatorEngine.GetValidator<Album>()
>                    .GetPotentialInvalidValues(columnName, this)
>                    .Select(iv => iv.Message)
>                    .ToArray();
>
>                return string.Join(Environment.NewLine, messages);
>            }
>        }
>
>
>        string IDataErrorInfo.Error
>        {
>            get
>            {
>                string[] messages =
> _validatorEngine.GetValidator<Album>()
>                    .GetInvalidValues(this)
>                    .Select(iv => iv.Message)
>                    .ToArray();
>
>                return string.Join(Environment.NewLine, messages);
>            }
>        }
>    }
>
> _validatorEngine come from anywhere. ServiceLocator....... I don't
> know.
>
>
> Then in your xaml the only thing that you need is this:
>
> <TextBox Text="{Binding Path=Album.Title,
> ValidatesOnDataErrors=true}" />
>
> (the important part is the ValidatesOnDataErrors = true).
>
>
> I will use the dynamicproxy way in the chinookmediamanager sample.
>
> >
>


-- 
Fabio Maulo

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To post to this group, send email to nhusers@googlegroups.com
To unsubscribe from this group, send email to 
nhusers+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/nhusers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to