@@ -41,7 +41,7 @@ public void CreateSchedule(TaskEntityContext context, ScheduleCreationOptions sc
4141 }
4242
4343 this . State . ScheduleConfiguration = ScheduleConfiguration . FromCreateOptions ( scheduleCreationOptions ) ;
44- this . TryStatusTransition ( nameof ( this . CreateSchedule ) , ScheduleStatus . Active ) ;
44+ this . State . Status = ScheduleStatus . Active ;
4545
4646 this . State . RefreshScheduleRunExecutionToken ( ) ;
4747 this . State . ScheduleCreatedAt = this . State . ScheduleLastModifiedAt = DateTimeOffset . UtcNow ;
@@ -142,7 +142,7 @@ public void PauseSchedule(TaskEntityContext context)
142142 Verify . NotNull ( this . State . ScheduleConfiguration , nameof ( this . State . ScheduleConfiguration ) ) ;
143143
144144 // Transition to Paused state
145- this . TryStatusTransition ( nameof ( this . PauseSchedule ) , ScheduleStatus . Paused ) ;
145+ this . State . Status = ScheduleStatus . Paused ;
146146 this . State . NextRunAt = null ;
147147 this . State . RefreshScheduleRunExecutionToken ( ) ;
148148
@@ -171,7 +171,7 @@ public void ResumeSchedule(TaskEntityContext context)
171171
172172 Verify . NotNull ( this . State . ScheduleConfiguration , nameof ( this . State . ScheduleConfiguration ) ) ;
173173
174- this . TryStatusTransition ( nameof ( this . ResumeSchedule ) , ScheduleStatus . Active ) ;
174+ this . State . Status = ScheduleStatus . Active ;
175175 this . State . NextRunAt = null ;
176176 this . logger . ResumedSchedule ( this . State . ScheduleConfiguration . ScheduleId ) ;
177177
@@ -268,17 +268,6 @@ bool CanTransitionTo(string operationName, ScheduleStatus targetStatus)
268268 return ScheduleTransitions . IsValidTransition ( operationName , this . State . Status , targetStatus ) ;
269269 }
270270
271- void TryStatusTransition ( string operationName , ScheduleStatus to )
272- {
273- if ( ! this . CanTransitionTo ( operationName , to ) )
274- {
275- this . logger . ScheduleOperationError ( this . State . ScheduleConfiguration ! . ScheduleId , nameof ( this . TryStatusTransition ) , $ "Invalid state transition from { this . State . Status } to { to } ") ;
276- throw new ScheduleInvalidTransitionException ( this . State . ScheduleConfiguration ! . ScheduleId , this . State . Status , to , operationName ) ;
277- }
278-
279- this . State . Status = to ;
280- }
281-
282271 DateTimeOffset DetermineNextRunTime ( ScheduleConfiguration scheduleConfig )
283272 {
284273 if ( this . State . NextRunAt . HasValue )
0 commit comments