EntityQuery 加载帮助
我有以下代码:
EntityQuery<Web.Ticket> query =
from t in ticketClass.getQuery()
where t.showId == selectedShowId
select t;
LoadOperation<Web.Ticket> loadTic = ticketClass.loadTicketsQuery(query);
loadTic.Completed += (s, a) =>
{
List<int> takenSeats = new List<int>();
foreach (Web.Ticket ticket in ticketClass.getContext())
{
takenSeats.Add((int)ticket.seatId);
MessageBox.Show(ticket.seatId.ToString());
}
};
getQuery:
public EntityQuery<Web.Ticket> getQuery()
{
return _ticketContext.GetTicketsQuery();
}
loadTicketsQuery:
public LoadOperation<Web.Ticket> loadTicketsQuery(EntityQuery<Web.Ticket> query)
{
return _ticketContext.Load(query);
}
getContext:
public EntitySet getContext()
{
return _ticketContext.Tickets;
}
我面临的问题是 MessageBox 未加载,我已确保应该捕获两条数据,但它永远不会到达那里。谁能帮我解释为什么我的代码不起作用。
谢谢。
I have the following code:
EntityQuery<Web.Ticket> query =
from t in ticketClass.getQuery()
where t.showId == selectedShowId
select t;
LoadOperation<Web.Ticket> loadTic = ticketClass.loadTicketsQuery(query);
loadTic.Completed += (s, a) =>
{
List<int> takenSeats = new List<int>();
foreach (Web.Ticket ticket in ticketClass.getContext())
{
takenSeats.Add((int)ticket.seatId);
MessageBox.Show(ticket.seatId.ToString());
}
};
getQuery:
public EntityQuery<Web.Ticket> getQuery()
{
return _ticketContext.GetTicketsQuery();
}
loadTicketsQuery:
public LoadOperation<Web.Ticket> loadTicketsQuery(EntityQuery<Web.Ticket> query)
{
return _ticketContext.Load(query);
}
getContext:
public EntitySet getContext()
{
return _ticketContext.Tickets;
}
The problem I am facing is that the MessageBox does not load, I have made sure there are two pieces of data that should be caught it never gets there. Can anyone help me on why my code isn't working.
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
试试这个
Try this