Example #1
0
 /// <summary>
 /// Creates a new STON union type, with a given sequence of permitted types.
 /// </summary>
 /// <param name="permittedTypes">The sequence of permitted types.</param>
 public StonUnionType(IEnumerable <IStonType> permittedTypes)
 {
     if (permittedTypes == null)
     {
         throw new ArgumentNullException("permittedTypes");
     }
     PermittedTypes = permittedTypes.Select(type => StonType.Copy(type)).ToList();
 }
Example #2
0
 /// <summary>
 /// Creates a new STON collection type, with a given collection element type.
 /// </summary>
 /// <param name="elementType">The type of the collection elements.</param>
 public StonCollectionType(IStonType elementType)
 {
     if (elementType == null)
     {
         throw new ArgumentNullException("elementType");
     }
     ElementType = StonType.Copy(elementType);
 }
Example #3
0
 /// <summary>
 /// Creates a new STON named type, with a given name and optional sequence of type parameters, regular or extension.
 /// </summary>
 /// <param name="name">The name of the type.</param>
 /// <param name="typeParameters">The sequence of type parameters</param>
 /// <param name="isExtension">Whether the type is an extension type or a regular type.</param>
 public StonNamedType(string name, IEnumerable <IStonType> typeParameters = null, bool isExtension = false)
 {
     if (name == null)
     {
         throw new ArgumentNullException("name");
     }
     Name           = name;
     TypeParameters = typeParameters?.Select(type => StonType.Copy(type)).ToList() ?? Enumerable.Empty <IStonType>();
     IsExtension    = isExtension;
 }
Example #4
0
 /// <summary>
 /// Creates a new STON valued entity, with a given declared type and global identifier.
 /// </summary>
 /// <param name="type">The declared type or the entity.</param>
 /// <param name="globalIdentifier">The global identifier of the entity.</param>
 protected StonValuedEntity(IStonType type, string globalIdentifier)
     : base(globalIdentifier)
 {
     Type = type != null?StonType.Copy(type) : null;
 }