public INotifyClient RegisterClient(INotifySource source) { var client = new NotifyClientImpl(context, source); context.Invoke_NotifyClientRegistration(client); return(client); }
public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient) { if (notifySource == null) { throw new ArgumentNullException("notifySource"); } if (action == null) { throw new ArgumentNullException("action"); } if (recipient == null) { throw new ArgumentNullException("recipient"); } Properties = new Hashtable(); Arguments = new List <ITagValue>(); RequaredTags = new List <string>(); Interceptors = new List <ISendInterceptor>(); NotifySource = notifySource; Recipient = recipient; NotifyAction = action; ObjectID = objectID; IsNeedCheckSubscriptions = true; }
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); } } } }
public ImageStorage2(string dbId, int tenant) { this.dbId = dbId; this.tenant = tenant; NotifySource = new PhotoManagerNotifySource(); NotifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource); }
public NotifyClientImpl(Context context, INotifySource notifySource) { if (notifySource == null) throw new ArgumentNullException("notifySource"); if (context == null) throw new ArgumentNullException("context"); this.notifySource = notifySource; ctx = context; }
INotifyClient INotifyRegistry.RegisterClient(INotifySource source, IServiceScope serviceScope) { //ValidateNotifySource(source); var client = new NotifyClientImpl(this, source, serviceScope); NotifyClientRegistration?.Invoke(this, client); return(client); }
public static T GetEnsure <T>(INotifySource source) where T : class { var result = GetInternal <T>(source); if (result == null) { throw new NotifyException(String.Format("\"{0}\" not instanced from notify source.", typeof(T).Name)); } return(result); }
INotifyClient INotifyRegistry.RegisterClient(INotifySource source) { //ValidateNotifySource(source); var client = new NotifyClientImpl(this, source); if (NotifyClientRegistration != null) { NotifyClientRegistration(this, client); } return(client); }
public NotifyClientImpl(Context context, INotifySource notifySource) { if (notifySource == null) { throw new ArgumentNullException("notifySource"); } if (context == null) { throw new ArgumentNullException("context"); } this.notifySource = notifySource; ctx = context; }
public NotifyRequest(INotifySource notifySource, INotifyAction action, string objectID, IRecipient recipient) { if (notifySource == null) throw new ArgumentNullException("notifySource"); if (action == null) throw new ArgumentNullException("action"); if (recipient == null) throw new ArgumentNullException("recipient"); Properties = new Hashtable(); Arguments = new List<ITagValue>(); RequaredTags = new List<string>(); Interceptors = new List<ISendInterceptor>(); NotifySource = notifySource; Recipient = recipient; NotifyAction = action; ObjectID = objectID; IsNeedCheckSubscriptions = true; }
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 NotifyClient(INotifyClient client, INotifySource source) { this.client = client; this.source = source; }
public INotifyClient RegisterClient(INotifySource source) { var client = new NotifyClientImpl(context, source); context.Invoke_NotifyClientRegistration(client); return client; }
public NotifyClientImpl(Context context, INotifySource notifySource) { this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource"); ctx = context ?? throw new ArgumentNullException("context"); }
INotifyClient INotifyRegistry.RegisterClient(INotifySource source) { //ValidateNotifySource(source); var client = new NotifyClientImpl(this, source); if (NotifyClientRegistration != null) { NotifyClientRegistration(this, client); } return client; }
static BirthdaysNotifyClient() { NotifySource = new BirthdaysNotifySource(); Instance = new BirthdaysNotifyClient(WorkContext.NotifyContext.NotifyService.RegisterClient(NotifySource)); }
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); } } } }
public NotifyClientImpl(Context context, INotifySource notifySource, IServiceScope serviceScope) { this.notifySource = notifySource ?? throw new ArgumentNullException("notifySource"); ServiceScope = serviceScope; ctx = context ?? throw new ArgumentNullException("context"); }
public static T Get <T>(INotifySource source) where T : class { return(GetInternal <T>(source)); }