Define a rule in Xml using a .Net Type Name

Description

Useful to use rules defined in other assemblies.

The method: CreateAttributeFromClass from class: NHibernate.Validator.Cfg.MappingSchema.RuleAttributeFactory fails when I set a rule validation with FullName + Assembly:

Example:
<attributename message="Custom Message">
Custom.Validation.CustomValidators.CustomClassAttribute, Custom.Validation.CustomValidators
</attributename>

The method needs this code:

if (type == null)
{
type = System.Type.GetType(GetText(attributename), true);
}

between this:

if (type == null)
{
type = assembly.GetType(entityType.Namespace + "." + GetText(attributename));
}

if (type == null)
{
throw new InvalidAttributeNameException(GetText(attributename), entityType);
}

Environment

None

Attachments

1

Activity

Show:

Dario Quintana March 10, 2011 at 4:03 PM

Fixed in r1661. Patch applied with minor change.

Dario Quintana March 10, 2011 at 4:01 PM

Thanks Julian.

Fixed

Details

Assignee

Reporter

Components

Fix versions

Priority

Who's Looking?

Open Who's Looking?
Created January 13, 2011 at 10:51 AM
Updated March 10, 2011 at 4:03 PM
Resolved March 10, 2011 at 4:03 PM
Who's Looking?