public void Register(IGrainID observerUnit) { if (!unitDict.TryAdd(observerUnit.GrainType, observerUnit)) { throw new ObserverUnitRepeatedException(observerUnit.GrainType.FullName); } }
public void Register(IGrainID followUnit) { if (!unitDict.TryAdd(followUnit.GrainType, followUnit)) { throw new RepeatedFollowUnitException(followUnit.GrainType.FullName); } }
public void Register <PrimaryKey>(string observerName, IGrainID observerUnit) { if (unitDict.TryGetValue(observerName, out List <object> units)) { units.Add(observerUnit); } if (!unitDict.TryAdd(observerName, new List <object> { observerUnit })) { throw new ObserverUnitRepeatedException(observerUnit.EventHandlerType.FullName); } }