Y
YankeeImperialistDog
I'll really try to explain this as clearly as i can.
I'm attempting to create a de-coupled validator to be used with NHibernate,
but before you object, this is not an NHibernate question. It's a question of
a limitation of interface limitation. Actually i hope not.
OK, here is the interface.
public interface IValidationRule<T>
{
bool RuleIsBorken(T entity);
string GetMessage();
}
And here is my problem
public class LastNameIsBlank : IValidationRule<Person>
{
public bool RuleIsBorken(Person entity)
{
var test = new ValidateForBlankProperty();
return test.testForBlank(entity, propertyToTest);
}
}
is tightly coupled to Person. Is there a way to make Person a variable type?
I'm open to alternatives.
Thanks
I'm attempting to create a de-coupled validator to be used with NHibernate,
but before you object, this is not an NHibernate question. It's a question of
a limitation of interface limitation. Actually i hope not.
OK, here is the interface.
public interface IValidationRule<T>
{
bool RuleIsBorken(T entity);
string GetMessage();
}
And here is my problem
public class LastNameIsBlank : IValidationRule<Person>
{
public bool RuleIsBorken(Person entity)
{
var test = new ValidateForBlankProperty();
return test.testForBlank(entity, propertyToTest);
}
}
is tightly coupled to Person. Is there a way to make Person a variable type?
I'm open to alternatives.
Thanks