${propertyname} is a new way to interpolate with NHV. It will interpolate
the value of the property into your message, the property exists into your
entity.

PropertyWithMessage is a property into your entity with the message, is the
only way you can override the default message, like I said, is a workaround
(a dirty one) for what you're looking for.

Config as *UseExternal*, was a breaking change, there are post at
nhforge.org blogs.

On Sat, Apr 18, 2009 at 12:50 PM, Lars Zeb <[email protected]> wrote:

>  Dario,
>
>
>
> Thanks for the reply and your contribution to Validator.
>
>
>
> Can you be more specific about using ${PropertyWithMessage}? Does it go in
> the Validator’s Attribute class? Where does the PropertyWithMessage property
> itself go, in the class being validated? Sorry, I am lost.
>
>
>
> I downloaded the alph3 source. When I run the app, it throws an exception.
> What have I done wrong?
>
>
>
> Lars
>
>
>
> NHibernate.Validator.Exceptions.ValidatorConfigurationException was
> unhandled
>
>   Message="Unexpected ValidatorMode :UseXml"
>
>   Source="NHibernate.Validator"
>
>   StackTrace:
>
>        at
> NHibernate.Validator.Cfg.CfgXmlHelper.ValidatorModeConvertFrom(String
> validatorMode) in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Cfg\CfgXmlHelper.cs:line
> 78
>
>        at
> NHibernate.Validator.Engine.ValidatorEngine.Configure(INHVConfiguration
> config, IMappingLoader mappingLoader) in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Engine\ValidatorEngine.cs:line
> 209
>
>        at
> NHibernate.Validator.Engine.ValidatorEngine.Configure(INHVConfiguration
> config) in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Engine\ValidatorEngine.cs:line
> 186
>
>        at NHibernate.Validator.Engine.ValidatorEngine.Configure(XmlReader
> configReader) in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Engine\ValidatorEngine.cs:line
> 171
>
>        at NHibernate.Validator.Engine.ValidatorEngine.Configure(String
> configFilePath) in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Engine\ValidatorEngine.cs:line
> 151
>
>        at NHibernate.Validator.Engine.ValidatorEngine.Configure() in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\src\NHibernate.Validator\Engine\ValidatorEngine.cs:line
> 137
>
>        at NHibernate.Validator.Demo.NHI.Program.TryToSaveAnInvalidEntity()
> in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\examples\Integration\NHibernate.Validator.Demo.NHI\NHibernate.Validator.Demo.NHI\Program.cs:line
> 43
>
>        at NHibernate.Validator.Demo.NHI.Program.Main() in
> E:\Development\NHibernate.Validator-1.2.0.Alpha3-src\examples\Integration\NHibernate.Validator.Demo.NHI\NHibernate.Validator.Demo.NHI\Program.cs:line
> 17
>
>        at System.AppDomain._nExecuteAssembly(Assembly assembly, String[]
> args)
>
>        at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence
> assemblySecurity, String[] args)
>
>        at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
>
>        at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
>
>        at System.Threading.ExecutionContext.Run(ExecutionContext
> executionContext, ContextCallback callback, Object state)
>
>        at System.Threading.ThreadHelper.ThreadStart()
>
>   InnerException: *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Dario Quintana
> *Sent:* Wednesday, April 15, 2009 2:40 PM
> *To:* [email protected]
> *Subject:* [nhusers] Re: NHibernate Validator custom message
>
>
>
> Hi
>
> Right now I think you can't do that, for that matter, but I have something
> in mind. Will review this later.
>
> Maybe you can workaround this using the NHV1.2(alpha but stable) doing
> something like this:
>
> "${PropertyWithMessage}"
>
> And your class has a property *PropertyWithMessage* as string. I know is
> dirty, but will solve your problem till we implement a better solution
> (think BeanValidation -java- calls it: Validation Context, so you can add
> errors to the current context).
>
> Cheers
>
>  On Wed, Apr 15, 2009 at 5:55 PM, Lars Zeb <[email protected]> wrote:
>
>
> I have created a customer class validator and it works OK. Using third-
> party software, it validates a postal address. This address validator
> uses Address, City, State and Zip properties.
>
> Instead of having the validator message associated with the class, I
> would like to have it associated with the Address property's message.
> And this message has about 500 variations depending on what error the
> third-party software finds, so I need to assign the Message property
> of Address at run time.
>
> Is this possible?
>
>
>
>
> --
> Dario Quintana
> http://darioquintana.com.ar
>
>
> >
>


-- 
Dario Quintana
http://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
-~----------~----~----~----~------~----~------~--~---

Reply via email to