private static CreatedContext InvokeClientFilter( IClientFilter filter, CreatingContext preContext, Func <CreatedContext> continuation) { preContext.Profiler.InvokeMeasured( filter, x => x.OnCreating(preContext), $"OnCreating for {preContext.Job.Type.FullName}.{preContext.Job.Method.Name}"); if (preContext.Canceled) { return(new CreatedContext(preContext, null, true, null)); } var wasError = false; CreatedContext postContext; try { postContext = continuation(); } catch (Exception ex) { wasError = true; postContext = new CreatedContext(preContext, null, false, ex); postContext.Profiler.InvokeMeasured( filter, x => x.OnCreated(postContext), $"OnCreated for {postContext.BackgroundJob?.Id ?? "(null)"}"); if (!postContext.ExceptionHandled) { throw; } } if (!wasError) { postContext.Profiler.InvokeMeasured( filter, x => x.OnCreated(postContext), $"OnCreated for {postContext.BackgroundJob?.Id ?? "(null)"}"); } return(postContext); }
private static CreatedContext InvokeClientFilter( IClientFilter filter, CreatingContext preContext, Func <CreatedContext> continuation) { filter.OnCreating(preContext); if (preContext.Canceled) { return(new CreatedContext( preContext, true, null)); } var wasError = false; CreatedContext postContext; try { postContext = continuation(); } catch (Exception ex) { wasError = true; postContext = new CreatedContext( preContext, false, ex); filter.OnCreated(postContext); if (!postContext.ExceptionHandled) { throw; } } if (!wasError) { filter.OnCreated(postContext); } return(postContext); }
public void SaveGlobalConfig(PaoObject configObject, int priority, IClientFilter clientFilter) { var dataService = DataService.Value; SecurityPublic.DemandPermission(ID, Permission_SaveGlobalConfig); dataService.ExecuteBySql(Sql_DisableCurrentLocalConfig , new DataParameter("@ConfigName", configObject.ID) , new DataParameter("@SoftwareID", PaoApplication.Default.SoftwareID)); var configTable = new ConfigDataSet.T_ConfigDataTable(); var configRow = configTable.AddT_ConfigRow(Guid.NewGuid() , PaoApplication.Default.SoftwareID , null , configObject.ID , priority , DateTime.Now , DateTime.MaxValue , IOPublic.Serialize <byte[]>(clientFilter) , IOPublic.Serialize <byte[]>(configObject)); dataService.UpdateTable(configTable, "T_Config"); }
private static CreatedContext InvokeClientFilter( IClientFilter filter, CreatingContext preContext, Func<CreatedContext> continuation) { filter.OnCreating(preContext); if (preContext.Canceled) { return new CreatedContext( preContext, true, null); } var wasError = false; CreatedContext postContext; try { postContext = continuation(); } catch (Exception ex) { wasError = true; postContext = new CreatedContext( preContext, false, ex); filter.OnCreated(postContext); if (!postContext.ExceptionHandled) { throw; } } if (!wasError) { filter.OnCreated(postContext); } return postContext; }