Try  [DisplayFormat(ConvertEmptyStringToNull = false)]

This post isn't exactly your scenario but it could be related to the
strings you have (nvarchar) and they might be defaulting to null?
http://stackoverflow.com/questions/3129080/server-side-validation-of-a-required-string-property-in-mvc2-entity-framework-4


worth a try anyway :)

the other way is to just set it on the client and then ignore what the
client provides.

On Fri, Mar 2, 2012 at 9:18 AM, David Burela <david.bur...@gmail.com> wrote:
>
> I've got a weird problem.
>
> There are tables in a database with these additional columns
"CreatedById", "ModifiedById". (They are nvarchar, not null)
> There is then an entity framework model for this (again, strings, not
null).
> RIA services is used to share the entities with the client.
>
> The problem is in Silverlight side. If I create a new Product class,
display it in a Dataform to allow the user to edit price, etc. I can't
submit product to the domain service because validation fails "CreatedById
can not be null". It makes no sense to set those values on the client side
as they could spoof those files. I have logic on the domain service side
that looks at the current authenticated user and automatically sets those
fields.
>
> But I can't submit them because validation keeps failing on those 2
fields.
> Is there a [NotRequired] property I could put on the domain service
metadata file?
> -David Burela
>
> _______________________________________________
> ozsilverlight mailing list
> ozsilverlight@ozsilverlight.com
> http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight
>
_______________________________________________
ozsilverlight mailing list
ozsilverlight@ozsilverlight.com
http://prdlxvm0001.codify.net/mailman/listinfo/ozsilverlight

Reply via email to