private void DataClass_Update_After(object sender, ObjectEventArgs e) { DataClassInfo Class = (DataClassInfo)e.Object; // If the "Continue" is false, it means that a DataClass_Update_Before found that the UrlPattern was changed // Otherwise the "Continue" will be true that this is the first time triggering it. if (!new RecursionControl("TriggerClassUpdateAfter_" + Class.ClassName).Continue) { DynamicRouteEventHelper.ClassUrlPatternChanged(Class.ClassName); } }
private void DataClass_Update_After(object sender, ObjectEventArgs e) { DataClassInfo Class = (DataClassInfo)e.Object; RecursionControl PreventDoubleClassUpdateTrigger = new RecursionControl("PreventDoubleClassUpdateTrigger_" + Class.ClassName); // If the "Continue" is false, it means that a DataClass_Update_Before found that the UrlPattern was changed // Otherwise the "Continue" will be true that this is the first time triggering it. if (!new RecursionControl("TriggerClassUpdateAfter_" + Class.ClassName).Continue&& PreventDoubleClassUpdateTrigger.Continue) { try { DynamicRouteEventHelper.ClassUrlPatternChanged(Class.ClassName); } catch (UrlSlugCollisionException ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "UrlSlugConflict", $"Occurred on Class Update After for class {Class.ClassName}"); e.Cancel(); } catch (Exception ex) { LogErrorsInSeparateThread(ex, "DynamicRouting", "Error", $"Occurred on Class Update After for class {Class.ClassName}"); } } }