请求匿名者在dataservice中键入silverlight [英] Request anonymouse Type in dataservice for silverlight

查看:79
本文介绍了请求匿名者在dataservice中键入silverlight的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在Silverlight 5上进行项目开发.
我使用数据服务连接到sql数据库.

当我想查询数据库时,我必须使用DataServiceCollection< t>.用于将我的数据加载到其中.
我想用这样的代码查询数据库

Hi
I am working on project base on Silverlight 5 .
I use data service for connection to sql database.

when i want to query database i must user DataServiceCollection<t> for loading my data into it.
I want to query database with like this code

DataServiceCollection<?anonymousetype?> collection= new DataServiceCollection<?anonymousetype?>();
               collection.LoadAsync( from sContract in _entityService.Entity.SContracts
                       select new
                                   {
                                       ContractID = sContract.ContractID,
                                       SCNTTitle = sContract.SCNTTitle,
                                       ContractNum = sContract.ContractNum,
                                       ContractDate = sContract.ContractDate,
                                       SupervisionName = sContract.User.FirstName + " " + sContract.User.Family,
                                       CompnayName = sContract.Contractors_Counselors.CompanyName,
                                   });




但出现错误

如何查询我的查询返回带有新关键字???的匿名类型的数据库?

非常感谢




but I got error

How can I query database that my Query return a anonymousetype with new keyword ???

thanks a lot

推荐答案

只需使用object作为返回类型.

rviceCollection<object> collection= new DataServiceCollection<object>();</object></object>
Just use object as the return type.

rviceCollection<object> collection= new DataServiceCollection<object>();</object></object>


这篇关于请求匿名者在dataservice中键入silverlight的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆