I'm using CSLA SL 4.0 beta 3. Today I tried applying data annotation attributes to a few properties of a class. I am not overriding AddBusinessRules(). When I create a new instance of the object on the SL side, the object.IsValid property is still true, when it should be false.
I see that AddBusinessRules() in the base is calling BusinessRules.AddDataAnnotations(), but for some reason, it's not finding the attributes on my properties.
Here is one of my properties:
private static readonly PropertyInfo<string> _notesProperty = RegisterProperty<string>(p => p.Notes);
[Required]
public string Notes
{
get { return GetProperty(_notesProperty); }
set { SetProperty(_notesProperty, value); }
}
Any thoughts?
Nevermind, for some reason it is now working. Not sure why, the code hasn't changed. I'll report back if I see this behavior again.
Try making the PropertyInfo public. There are problems with SL when this is private.
Copyright (c) Marimer LLC