开发者

Silverlight DbContext Validation - Entity Attributes ignored on client side

开发者 https://www.devze.com 2023-03-05 20:18 出处:网络
I\'m using a DbContext provided by a DomainService in my Silverlight 5 (Beta) application. I\'m getting warning messages while building the project:

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

精彩评论

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

关注公众号