8,736
社区成员
发帖
与我相关
我的任务
分享
[EnableClientAccess()]
public class CustomerDomainService : DomainService
{
数据库 context = new 数据库();
public IQueryable<数据库中的表> Get_我的表(int id)
{
return from temp in context.数据库中的表
where temp.ID == id
select temp;
}
}
客户端:
public partial class MainPage : UserControl
{
private CustomerDomainContext _customerContext = new CustomerDomainContext();
public MainPage()
{
InitializeComponent();
LoadOperation<数据库中的表> lo =_customerContext.Load(_customerContext.Get_我的表Query(1));
lo.Completed += new EventHandler(lo_Completed);
}
void lo_Completed(object sender, EventArgs e)
{
LoadOperation<数据库中的表> contact = (LoadOperation<数据库中的表>)sender;
dataGrid1.ItemsSource = contact.Entities;
//dataGrid1.ItemsSource = contact.Entities.Take(数量);
}
}