how can I read from entity Framework?
I use this to insert items:
public void Insert()
{
using (HistoryContainer db = new HistoryContainer())
{
HistoryData e = new HistoryData();
e.MP = IpAddress;
e.Number = OtherPartyNumber;
e.DateTimeStart = DateTime.Now;
e.Duration = duration;
e.TypeDescription = type;
e.text = e.text;
db.AddToHistoryDataSet(e);
db.SaveChanges();
}
}
I tried this to read them:
public virtual IEnumerable<HistoryContainer> ReadFirst()
{
using (HistoryContainer x = new HistoryContainer())
{
foreach (var item in HistoryData.where(b => b.MP == IpAddress))
{
_history.Add(new HistoryItem(item));
}
}
}
But it didn’t work. What’s wrong?
Thanks.
1 Answer