private void ValidateNotifySource(INotifySource source) { foreach (var a in source.GetActionProvider().GetActions()) { IEnumerable <string> senderNames; lock (channels) { senderNames = channels.Values.Select(s => s.SenderName); } foreach (var s in senderNames) { try { var pattern = source.GetPatternProvider().GetPattern(a, s); if (pattern == null) { throw new NotifyException(string.Format("In notify source {0} pattern not found for action {1} and sender {2}", source.ID, a.ID, s)); } } catch (Exception error) { LogManager.GetLogger("ASC.Notify").ErrorFormat("Source: {0}, action: {1}, sender: {2}, error: {3}", source.ID, a.ID, s, error); } } } }
private static T GetInternal <T>(INotifySource source) where T : class { T result = null; if (source == null) { return(null); } if (typeof(T) == typeof(IActionPatternProvider)) { result = (T)WrappedGet(() => source.GetActionPatternProvider()); } if (typeof(T) == typeof(IActionProvider)) { result = (T)WrappedGet(() => source.GetActionProvider()); } if (typeof(T) == typeof(IPatternProvider)) { result = (T)WrappedGet(() => source.GetPatternProvider()); } if (typeof(T) == typeof(IDependencyProvider)) { result = (T)WrappedGet(() => source.GetDependencyProvider()); } if (typeof(T) == typeof(ISubscriptionProvider)) { result = (T)WrappedGet(() => source.GetSubscriptionProvider()); } if (typeof(T) == typeof(IRecipientProvider)) { result = (T)WrappedGet(() => source.GetRecipientsProvider()); } if (typeof(T) == typeof(ISubscriptionSource)) { result = (T)WrappedGet(() => source.GetSubscriptionSource()); } return(result); }
private void ValidateNotifySource(INotifySource source) { foreach (var a in source.GetActionProvider().GetActions()) { var senderNames = Enumerable.Empty<string>(); lock (channels) { senderNames = channels.Values.Select(s => s.SenderName); } foreach (var s in senderNames) { try { var pattern = source.GetPatternProvider().GetPattern(a, s); if (pattern == null) { throw new NotifyException(string.Format("In notify source {0} pattern not found for action {1} and sender {2}", source.ID, a.ID, s)); } } catch (Exception error) { log4net.LogManager.GetLogger("ASC.Notify").ErrorFormat("Source: {0}, action: {1}, sender: {2}, error: {3}", source.ID, a.ID, s, error); } } } }