开发者

Silverlight DbContext Validation - Entity Attributes ignored on client side

I'm using a DbContext provided by a DomainService in my Silverlight 5 (Beta) application. I'm getting warning messages while building the project:

The attribute 'System.ComponentModel.DataAnnotations.MaxLengthAttribute' requires a reference to System.ComponentModel.DataAnnotations in the client project. Skipping generation of attribute. Please add a reference to System.ComponentModel.DataAnnotations to ensure generation of the attribute.

The thing is th开发者_JS百科at, there is no MaxLengthAttribute attribute in System.ComponentModel.DataAnnotations at client side. In consequence, I'm not able to validate any property length before the record has been sent to the server ... Does anybody know a solution?


MaxLengthAttribute is in EntityFramework.dll and I'm almost sure that it cannot be used in Silverlight because it would require Silverlight version of EntityFramework.dll which doesn't exist.


Try using the StringLengthAttribute instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜