0
Fixed

ShortValueValidatorFactory

Daniel Walters 13 years ago updated by anonymous 8 years ago 5

A validator "short cut" is required so that in connector configuration files a column can be given the type of short. This was required when importing from a SQL Server DB with a smallint value.

Shane attempted to create one but there were problems with this deeper in the framework to do with IComparable methods not being implemented for a particular data type or something. Below is the code he tried and the errors returned.

public class ShortValueValidatorFactory : Unify.Framework.ValidatorFactory.RangeValidatorFactoryBase<ShortValue, int>
{

protected override ShortValue GetValue(System.Xml.Linq.XName attribute, ShortValue missingValue, System.Xml.Linq.XElement fieldXml)

{ return (ShortValue)Convert.ToInt16(fieldXml.Value); }

protected override ShortValue MissingMaxValue()

{ return (ShortValue)Int16.MaxValue; }

protected override ShortValue MissingMinValue()

{ return (ShortValue)Int16.MinValue; }

}
}

Error 1 The type 'Unify.Framework.ShortValue' cannot be used as type parameter 'TValue' in the generic type or method 'Unify.Framework.ValidatorFactory.RangeValidatorFactoryBase<TValue,T>'. There is no boxing conversion from 'Unify.Framework.ShortValue' to 'System.IComparable<Unify.Framework.ShortValue>'. \\VBOXSVR\VMShare\DETSAFEPersonConnector\DETSAFEPersonConnector\DETSAFEPersonConnector\Connector\Unify.Connector.DETSAFEPerson\ShortValueValidatorFactory.cs 9 18 Unify.Connector.DETSAFEPerson

Error 2 The type 'Unify.Framework.ShortValue' cannot be used as type parameter 'TValue' in the generic type or method 'Unify.Framework.ValidatorFactory.RangeValidatorFactoryBase<TValue,T>'. There is no boxing conversion from 'Unify.Framework.ShortValue' to 'Unify.Framework.IValue<int>'. \\VBOXSVR\VMShare\DETSAFEPersonConnector\DETSAFEPersonConnector\DETSAFEPersonConnector\Connector\Unify.Connector.DETSAFEPerson\ShortValueValidatorFactory.cs 9 18 Unify.Connector.DETSAFEPerson

Hey Adam, you can close this if you want. I think Shane wrote an override for something but I don't remember exactly what the resolution was for this now though we did get it working in the end.

I know we've already (partially) fixed this for the next version with the IValue changes we made Adam, but I don't know if they were the only changes we require.

Still requires the validator factory to provide the shortcut "short" in the schema.

Short value (single and multi) validators added, and unit tested from schema generation level. Please confirm resolution.