简体   繁体   中英

WCF RIA +SL4 - how to validate a collection?

I'm using WCF RIA + Silverlight 4.0 in my project.

On client and server side I need to check (via validation process) if collection (eg Orders) that belongs to eg Manager is filled or not. The rule is that at least one Order should be there otherwise validation failed. Orders are loaded together with Manager via [Include] attribute so on client side i have all orders available. I created Custom validator and check if collection is null or empty.

Problem - on client side after domainDataSource.Submit() in custom validator i can see orders loaded but after that there is another check - on SERVER side and there is no any Order in collection so this check is never passes.

What is the correct way to check collection - is it empty or not?

Thanks in advance!

PS - it seems like i have to separate validation process with #if SILVERLIGHT ... #else ... #endif directives and on server side load all Orders from DB and check it this way. But it seems a 'bit' wrong to check it this way...

在服务器端,您必须控制订单号并检查数据库,因为如果更改了某些内容,服务器将仅接收新订单。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM