开发者

SaveChanges(): "...can only appear on the left hand..."

I have this piece of code:

Schedule chk = _entities.Schedules.Where(x => x.ScheduleStart == schedule.ScheduleStart && x.ScheduleEnd <= schedule.ScheduleEnd).FirstOrDefault();

if (chk != null)
{
     chk.Discontinued = true;
     _entities.SavingChanges();
}

basically if something exists in database with that criteria, set discontinued = true and save...

but I get this error:

The event 'System.Data.Objects.ObjectContext.SavingChanges' can only appear 开发者_如何学Goon the left hand side of += or -=

What is wrong?

/M


You're calling the wrong method. SavingChanges is an event, not a method. You want SaveChanges, instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜