//public SubscriberCollection GetSubscriptions(IPropBag host, PropIdType propId, SimplePropStoreAccessService storeAccessor) //{ // SimpleExKey exKey = GetTheKey(host, propId, storeAccessor); // SubscriberCollection result = GetSubscriptions(exKey); // return result; //} //public SubscriberCollection GetSubscriptions(IPropBag host, PropIdType propId, PSAccessServiceInterface storeAccessor) //{ // SimpleExKey exKey = GetTheKey(host, propId, storeAccessor); // SubscriberCollection result = GetSubscriptions(exKey); // return result; //} //private SimpleExKey GetTheKey(IPropBag host, uint propId, SimplePropStoreAccessService storeAccessor) //{ // SimpleExKey result = ((IHaveTheSimpleKey)storeAccessor).GetTheKey(host, propId); // return result; //} //private SimpleExKey GetTheKey(IPropBag host, uint propId, PSAccessServiceInterface storeAccessor) //{ // ExKeyType exKey = ((HaveTheKeyType) storeAccessor).GetTheKey(host, propId); // SimpleExKey withWeakRef = SimpleExKey.FromIExploadedKeyWithWeakRef(exKey); // return withWeakRef; //} #endregion #region Private Methods private CollectionOfSubscriberCollections GetPropIndexForObject(ObjectIdType objectKey, out bool wasAdded) { bool internalWasAdded = false; CollectionOfSubscriberCollections result = _propIndexesByObject.GetOrAdd ( key: objectKey, valueFactory: ( x => { internalWasAdded = true; return(new CollectionOfSubscriberCollections()); } ) ); wasAdded = internalWasAdded; return(result); }
public SubscriberCollection GetSubscriptions(ExKeyType exKey) { CollectionOfSubscriberCollections propIndex = GetPropIndexForObject(exKey.Level1Key, out bool propIndexWasCreated); if (propIndexWasCreated) { System.Diagnostics.Debug.WriteLine($"Created a new CollectionOfSubscriberCollections for {exKey}."); } SubscriberCollection result = propIndex.GetOrCreate(exKey.Level2Key, out bool subcriberListWasCreated); if (subcriberListWasCreated) { System.Diagnostics.Debug.WriteLine($"Created a new SubscriberCollection for {exKey}."); } return(result); }