This repository was archived by the owner on Aug 18, 2021. It is now read-only.
This repository was archived by the owner on Aug 18, 2021. It is now read-only.
LightRepository won't correctly validate enumerable properties #26
Open
Description
Looking at the Validate
method inside the LightRepository
class, from line 151 we can notice that when it encounters a property which is an IList, it recursively validates its children:
If we take a closer look at line 160, we can spot the bug. It's checking if the property type is generic instead of the current item's type. This looks like a copy & paste typo.
So, this will not validate enumerables at all.
To prove this is really a bug, try passing the class below as an argument and you'll see that it will not validate the TestList
property:
public class InheritsLightModel : LightModel<InheritsLightModel>
{
//this property will not be validated
public List<InheritsLightModel> TestList { get; set; }
public override void Validate()
{
}
}