var log = new Logs()
{
Message = "测试消息",
Time=DateTime.Now
};
context.Logs.InsertOnSubmit(log);
context.SubmitChanges();
DisplayLogs("显示全部的", query1);
var firstLog = context.Logs.FirstOrDefault(l => l.Id == 1);
if (firstLog != null)
{
firstLog.Message = "修改过之后的消息";
context.SubmitChanges();
DisplayLogs("显示全部的", query1);
}
var deleteEntry = from l in context.Logs
where l.Id == 1
select l;
var found = deleteEntry.FirstOrDefault();
if (found != null) {
context.Logs.DeleteOnSubmit(found);
context.SubmitChanges();
DisplayLogs("显示全部的", query1);
}
Console.Read();
}
private static void DisplayLogs(string message,