/// <summary> /// Search all data of specified type. /// </summary> /// <typeparam name="TValue">data type</typeparam> /// <param name="repository">queryable repository</param> /// <returns>found items</returns> public static TValue[] Search <TValue>(this IQueryableRepository <TValue> repository) where TValue : IDataSource { Contract.Requires(repository != null); return(repository.Search <TValue>(null, null, null)); }
public void InvalidateAll() { var found = Repository.Search(); var data = new ConcurrentDictionary <string, TValue>(1, found.Length); foreach (var f in found) { data.TryAdd(f.URI, f); } var prev = Data; Data = data; prev.Clear(); }
public void Handle(ChangeBrush domainEvent) { var session = domainEvent.Session; var artistSearch = new Artist.GetArtistBySession(domainEvent.Session); var artists = artistRepository.Search(artistSearch, 1, 0); if (artists.Length != 1) { throw new ArgumentException("Unauthorized; session \"" + session + "\" does not exist!"); } var brush = new Brush(); brush.Artist = artists[0]; brush.Color = domainEvent.Color; brushRepository.Insert(brush); // return new brush identifier via the event instance domainEvent.BrushID = brush.ID; }
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); } }