这段代码给了我和异常
收藏已修改;枚举操作可能无法执行
我使用实体框架来处理数据
foreach (OfflineMessage omc in _offMsgs)
{
var OimDB = new OimDBEntities();
if (omc.MsgTo == e.MessageData.ToHeader.Uri)
{
var offlineMessage = new OfflineMessage
{
Delivered = false,
MsgContent = omc.MsgContent,
MsgFrom = omc.MsgFrom,
MsgTime = omc.MsgTime,
MsgTo = omc.MsgTo,
ID = OimDB.OfflineMessages.NextId(f => f.ID)
};
oimRepository.InsertOIM(offlineMessage);
//InsertData(omc.MsgFrom, omc.MsgTo, omc.MsgContent, omc.MsgTime);
}
}
_toHeader = e.MessageData.ToHeader.Uri;
}