Silverlight DataGrid填充实体框架

时间:2012-03-19 16:23:59

标签: c# entity-framework silverlight-5.0

EntityQuery<hr_Employee> query = from s in db.hr_Scorings
                                             join ds in db.hr_DayScores
                                             on s.DayScoreId equals ds.DayScoreId
                                             join em in db.hr_Employees
                                             on s.EmployeeId equals em.EmployeeId
                                             select new
                                             {
                                                 em.Name,
                                                 em.Surname,
                                                 s.ScoreDate,
                                                 ds.DayScore
                                             };
            LoadOperation<hr_Employee> loadOp = this.db.Load(query);
            dataGrid1.ItemsSource = loadOp.Entities;

我无法使用entityframework填充datagrid,它给了我一个错误。

"Cannot implicitly convert type 'System.Collections.Generic.I'System.ServiceModel.DomainServices.Client.EntityQuery<BusinessApplication1.Web.hr_Employee>"

我找到了来自msdn的代码;

EntityQuery<Customer> query = 
            from c in _customerContext.GetCustomersQuery()
            where c.Phone.StartsWith("583")
            orderby c.LastName
            select c;
        LoadOperation<Customer> loadOp = this._customerContext.Load(query);
        CustomerGrid.ItemsSource = loadOp.Entities;

但我们如何使用msdn代码中的代码连接多个表?感谢

0 个答案:

没有答案