/// <inheritdoc/>
        public void AddPossibleType(IObjectGraphType type)
        {
            if (type == null)
            {
                throw new ArgumentNullException(nameof(type));
            }

            this.IsValidInterfaceFor(type, throwError: true);
            PossibleTypes.Add(type);
        }
Beispiel #2
0
        public IEnumerable <ICodeDescriptor> GetChildren()
        {
            yield return(ResultDescriptor);

            ;

            foreach (IClassDescriptor possibleType in
                     PossibleTypes.Select(t => t.ResultDescriptor))
            {
                yield return(possibleType);
            }
        }
Beispiel #3
0
        public UnionType(string name, IEnumerable <ObjectType> possibleTypes, string description = null,
                         IEnumerable <DirectiveInstance> directives = null) : base(name, description, directives)
        {
            foreach (var possibleType in possibleTypes)
            {
                if (PossibleTypes.ContainsKey(possibleType.Name))
                {
                    throw new InvalidOperationException(
                              $"Type {Name} already has possibleType with name {possibleType.Name}");
                }

                PossibleTypes[possibleType.Name] = possibleType;
            }
        }
 /// <summary>
 /// Constructor used by specializations
 /// </summary>
 /// <param name="type">Type of request that being created</param>
 protected Request(PossibleTypes type)
 {
     RequestType = type;
 }
 /// <inheritdoc/>
 public void AddPossibleType(IObjectGraphType type)
 {
     PossibleTypes.Add(type);
 }
Beispiel #6
0
 /// <summary>
 /// Constructor used by all specializations, which in turn are used by
 /// senders of a message
 /// </summary>
 /// <param name="type">Type of request that being created</param>
 /// <param name="status">Status of the ack/nak</status>
 /// <param name="note">error message or note</note>
 protected Reply(PossibleTypes type, PossibleStatus status, string note)
 {
     ReplyType = type;
     Status    = status;
     Note      = note;
 }
 /// <summary>
 /// Constructor used by all specializations, which in turn are used by
 /// senders of a message 
 /// </summary>
 /// <param name="type">Type of request that being created</param>
 /// <param name="status">Status of the ack/nak</status>
 /// <param name="note">error message or note</note>
 protected Reply(PossibleTypes type, PossibleStatus status, string note)
 {
     ReplyType = type;
     Status = status;
     Note = note;
 }
 /// <summary>
 /// Constructor used by specializations
 /// </summary>
 /// <param name="type">Type of request that being created</param>
 protected Request(PossibleTypes type)
 {
     RequestType = type;
 }
Beispiel #9
0
 /// <summary>
 /// Determines whether this instance can handle the specified type.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns></returns>
 public bool CanHandleType(Type type)
 {
     type = GetNotNullableType(type);
     return(PossibleTypes.Any(x => x.Type == type));
 }