public static Dictionary<Guid, List<ChatEvent>> InitializeExistingEventDictionary() { DataConnection = new ChannelServiceDataContext(); var channelList = from ch in DataConnection.Channels select ch; Dictionary<Guid, List<ChatEvent>> list = new Dictionary<Guid, List<ChatEvent>>(); foreach (Channel c in channelList) { list.Add(c.ChannelID, new List<ChatEvent>()); var events = from ev in DataConnection.ChatEvents where ev.ChannelID == c.ChannelID //&& ev.Time >= (DateTime.Now - new TimeSpan(1, 0, 0, 0)) select ev; list[c.ChannelID].AddRange(events); } return list; }
public static Dictionary <Guid, List <ChatEvent> > InitializeExistingEventDictionary() { DataConnection = new ChannelServiceDataContext(); var channelList = from ch in DataConnection.Channels select ch; Dictionary <Guid, List <ChatEvent> > list = new Dictionary <Guid, List <ChatEvent> >(); foreach (Channel c in channelList) { list.Add(c.ChannelID, new List <ChatEvent>()); var events = from ev in DataConnection.ChatEvents where ev.ChannelID == c.ChannelID //&& ev.Time >= (DateTime.Now - new TimeSpan(1, 0, 0, 0)) select ev; list[c.ChannelID].AddRange(events); } return(list); }