This project has moved. For the latest updates, please go here.

DictionarySubject initial snapshot

Topics: General, Reactive (Rx)
May 16, 2012 at 3:29 PM

Hi,

Is it possible to use DictionarySubject and receive the initial snapshot as a series of CollectionNotification.Add messages instead of a single Exists message?

This way I can treat the whole stream of notifications in the same manner (several .Where filters) and dont need specific processing to handle the exists message.

many thanks for the great library

Coordinator
Jul 31, 2012 at 5:41 PM
Edited Jul 31, 2012 at 5:43 PM

Hi,

That was our original design for a method called View, but the behavior was changed in a subsequent release.

You can now do something similar using SelectMany.

For example: (untested)

dictSubject.SelectMany(n => 
	n.Kind == CollectionNotificationKind.Exists
	? n.ExistingValues.Select(CollectionNotification.CreateOnAdded)
	: Scalar.Return(n))

- Dave