public virtual void OnTurnedOff(TurnedOffEventArgs e) { _tvState.IsOn = false; _tvState.Version = e.Version; dataContext.Update(_tvState, x => x.IsOn, x => x.Version); dataContext.Commit(); Console.WriteLine("TurnedOffEventArgs"); }
/// <summary>Turns the television off.</summary> /// <exception cref="InvalidOperationException">The television is not powerd on.</exception> public void TurnOff() { if (!IsOn) { throw new InvalidOperationException("The television is not on and cannot be turned off."); } TurnedOffEventArgs e = new TurnedOffEventArgs(); EntityState.Apply(e); }
protected virtual void OnTurnedOff(TurnedOffEventArgs e) { IsOn = false; }