求助silverlight+ado.net实体模型+域服务下如何用select选择器?
我想在查询时只返回想要的列,别把所有的列都返回,就是弄不明白怎么写。请问这应该怎么弄?
AccountsDomainContext context = new AccountsDomainContext(); var query = from x in context.GetCompanysQuery() where x.CompanyName.Equals("北京") select x.CompanyId; //错误:无法将类型CompanyId隐式转换为Companys
AccountsDomainContext context = new AccountsDomainContext(); context.Load(context.GetCompanysQuery().Select(x=>x.CompanyId) //同样的错误 , callback => { if (!callback.HasError) { dataGrid1.ItemsSource = callback.Entities; } }, null);
[OperationContract]public Models.TMaster GetEntity(string masterKey){ using (Models.TestDataClassesDataContext db = new Models.TestDataClassesDataContext()) { db.DeferredLoadingEnabled = false; System.Data.Linq.DataLoadOptions option = new System.Data.Linq.DataLoadOptions(); option.LoadWith<Models.TMaster>(m => m.TDetail); db.LoadOptions = option; return db.TMaster.FirstOrDefault(m => m.MasterKey == masterKey); }}