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

Sep 20, 2013 at 9:13 PM
Hi,
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?

Thanks...Ron
Editor
Sep 23, 2013 at 5:10 PM
Hi,

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?

Thanks,

Damian Cherubini
http://blogs.southworks.net/dcherubini
Sep 24, 2013 at 7: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