public FlowObservation Get(AreaTypeName name) { if (!TryGet(name, out var observation)) { throw new KeyNotFoundException($"This set does not contain the specified name: {name}"); } return(observation); }
public T Get(AreaTypeName name) { if (!TryGet(name, out var type)) { throw new KeyNotFoundException($"This set does not contain the specified name: {name}"); } return(type); }
public FlowType GetFlow(AreaTypeName name) { if (!TryGetFlow(name, out var type)) { throw new KeyNotFoundException($"This map does not contain a flow with the specified name: {name}"); } return(type); }
AreaTypeInfo( Type declaredType, AreaTypeName name, bool isEvent, bool isTopic, bool isQuery) { DeclaredType = declaredType; Name = name; IsEvent = isEvent; IsTopic = isTopic; IsQuery = isQuery; }
public bool TryGetFlow(AreaTypeName name, out FlowType type) { if (Topics.TryGet(name, out var topic)) { type = topic; } else if (Queries.TryGet(name, out var query)) { type = query; } else { type = null; } return(type != null); }
static AreaTypeInfo TryFrom <TAssignable>(Type type, bool isEvent = false, bool isTopic = false, bool isQuery = false) { if (!typeof(TAssignable).IsAssignableFrom(type)) { return(null); } var currentType = type; var currentName = type.Name; while (currentType.IsNested) { currentType = currentType.DeclaringType; currentName = $"{currentType.Name}.{currentName}"; } return(new AreaTypeInfo(type, AreaTypeName.From(currentName), isEvent, isTopic, isQuery)); }
public bool TryGet(AreaTypeName name, out T type) => _byName.TryGetValue(name, out type);
public bool Contains(AreaTypeName name) => _byName.ContainsKey(name);
public T this[AreaTypeName name] => Get(name);
public bool TryGet(AreaTypeName name, out FlowObservation observation) => _byName.TryGetValue(name, out observation);
public FlowObservation this[AreaTypeName name] => _byName[name];