[Required] attribute on value types during a PutAsJsonAsync is not working

Sep 20, 2013 at 10:13 PM
I've been using [Required(ErrorMessageResourceType = typeof(Resources), ErrorMessageResourceName = "ErrorRequired")] with string properties of my entites and it works.
When I use the same validation attribute with a DateTime with PutAsyncJsonAsync it does not work.
I've googled about the problem and the workaround is to also mark the property with [DataMember(IsRequired=true)]. http://stackoverflow.com/questions/16418198/putasjsonasync-does-not-work-when-dto-has-data-annotations

Is there a way to do the workaround in Prism for Windows Runtime?

Sep 23, 2013 at 6:10 PM

I'm not understanding what you mean with "Is there a way to apply the workaround in Prism for Windows Runtime?"
Based on the discussion of the link, the workaround you mention is simply adding a DataMemberAttribute to the properties of your model, which I believe is supported in Windows Store Apps. This seems to be independent of Prism.

Have you experienced any unexpected behavior or issue when applying the workaround in your models?


Damian Cherubini
Sep 24, 2013 at 8:50 PM
Thanks for replying Damian.

At the time I posted I thought that [DataMember(IsRequired=true)] was not supported in Class Library(Windows Store apps). Thought I tried but guess I didn't.
You are correct. It builds in both Windows Store Apps Class Library and Windows Class Library.
Problem solved.

Thanks again...Ron Lemire