public RegisterChangeNotifications(IDataChangeNotification notifications) { var target = typeof(TSource); if (target.IsGenericType && target.GetGenericTypeDefinition() == typeof(Lazy <>)) { target = target.GetGenericArguments()[0]; if (target.IsArray) { target = target.GetElementType(); dynamic cn = Activator.CreateInstance(typeof(ChangeNotifications <>).MakeGenericType(target), new object[] { notifications }); Register = cn.SubscribeBulk; ChangeNotification = cn; } else { dynamic cn = Activator.CreateInstance(typeof(ChangeNotifications <>).MakeGenericType(target), new object[] { notifications }); Register = cn.SubscribeLazy; ChangeNotification = cn; } } else { var cn = new ChangeNotifications <TSource>(notifications); Register = cn.SubscribeEager; ChangeNotification = cn; } }
public IObservable <NotifyInfo> Track <T>() where T : IIdentifiable { if (Changes == null) { Changes = Locator.Resolve <IDataChangeNotification>(); } var name = typeof(T).FullName; return(Changes.Notifications.Where(ni => ni.Name == name)); }
public LookupCache( IRepository <TValue> repository, IDataChangeNotification notifications) { Contract.Requires(repository != null); Contract.Requires(notifications != null); this.Repository = repository; Subscription = notifications.Notifications.Subscribe(CheckInvalidate); }
public QueueProcessor( IMailService mailService, IQueryableRepository<IMailMessage> repository, IDataChangeNotification changeNotification) { Contract.Requires(mailService != null); Contract.Requires(repository != null); Contract.Requires(changeNotification != null); this.MailService = mailService; this.Repository = repository; this.ChangeNotification = changeNotification; }
public LazyCache( IQueryableRepository <TValue> repository, IDataChangeNotification notifications) { Contract.Requires(repository != null); Contract.Requires(notifications != null); this.Repository = repository; Subscription = notifications.Notifications.Subscribe(Synchronize); Data = new Dictionary <string, TValue>(); Invalid = true; }
public QueueProcessor( IMailService mailService, IQueryableRepository <IMailMessage> repository, IDataChangeNotification changeNotification) { Contract.Requires(mailService != null); Contract.Requires(repository != null); Contract.Requires(changeNotification != null); this.MailService = mailService; this.Repository = repository; this.ChangeNotification = changeNotification; }
public SingleDomainEventSource(IDataChangeNotification notifications) { Contract.Requires(notifications != null); Subscription = notifications.Track <TEvent>().Subscribe(kv => { foreach (var ev in kv.Value.Value) { Subject.OnNext(ev); } }); Events = Subject.AsObservable(); }
public QueueProcessor( IMailService mailService, IQueryableRepository<IMailMessage> repository, IDataChangeNotification changeNotification, ILogFactory logFactory) { Contract.Requires(mailService != null); Contract.Requires(repository != null); Contract.Requires(changeNotification != null); Contract.Requires(logFactory != null); this.MailService = mailService; this.Repository = repository; this.ChangeNotification = changeNotification; this.Logger = logFactory.Create("Mail Queue processor"); }
public QueueProcessor( IMailService mailService, IQueryableRepository <IMailMessage> repository, IDataChangeNotification changeNotification, ILogFactory logFactory) { Contract.Requires(mailService != null); Contract.Requires(repository != null); Contract.Requires(changeNotification != null); Contract.Requires(logFactory != null); this.MailService = mailService; this.Repository = repository; this.ChangeNotification = changeNotification; this.Logger = logFactory.Create("Mail Queue processor"); }
public ChangeNotifications(IDataChangeNotification notifications) { Subscription = notifications.Track <TSource>().Subscribe(kv => Subject.OnNext(kv)); var source = Subject.AsObservable(); BulkChanges = source.Select(it => it.Value); LazyChanges = from it in source let lazy = it.Value from i in Enumerable.Range(0, it.Key.Length) select new Lazy <TSource>(() => lazy.Value[i]); EagerChanges = from it in source from v in it.Value.Value select v; }
public EagerCache( IRepository <TValue> lookup, IQueryableRepository <TValue> repository, IDataChangeNotification notifications) { Contract.Requires(lookup != null); Contract.Requires(repository != null); Contract.Requires(notifications != null); this.Lookup = lookup; this.Repository = repository; Subscription = notifications.Notifications.Subscribe(Synchronize); var found = repository.Search(); Data = new ConcurrentDictionary <string, TValue>(1, found.Length); foreach (var f in found) { Data.TryAdd(f.URI, f); } }