public static T DoServiceCall <T>(this UserGraphTreeParams requestParams, Func <UserGraphTreeParams, T> func) { ServiceBrokerContext.Current.SaveContextStates(); try { if (requestParams.ShowDeletedObjects) { ServiceBrokerContext.Current.UseLocalCache = false; ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All; } else { ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.Common; } return(func(requestParams)); } finally { ServiceBrokerContext.Current.RestoreSavedStates(); } }
public static void DoServiceCall(this UserGraphTreeParams requestParams, Action <UserGraphTreeParams> action) { ServiceBrokerContext.Current.SaveContextStates(); try { if (requestParams.ShowDeletedObjects) { ServiceBrokerContext.Current.UseLocalCache = false; ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.All; } else { ServiceBrokerContext.Current.ListObjectCondition = ListObjectMask.Common; } action(requestParams); } finally { ServiceBrokerContext.Current.RestoreSavedStates(); } }