示例#1
0
        /// <summary>
        /// Add the provided resource definition JSON schema to this resourceh schema.
        /// </summary>
        /// <param name="resourceName">The name of the resource definition.</param>
        /// <param name="resourceDefinition">The JSON schema that describes the resource.</param>
        public ResourceSchema AddResourceDefinition(string resourceName, ResourceDefinition resourceDefinition)
        {
            if (string.IsNullOrWhiteSpace(resourceName))
            {
                throw new ArgumentException("resourceName cannot be null or whitespace", "resourceName");
            }
            if (resourceDefinition == null)
            {
                throw new ArgumentNullException("resourceDefinition");
            }

            if (ResourceDefinitions.ContainsKey(resourceName))
            {
                throw new ArgumentException("A resource definition for \"" + resourceName + "\" already exists in this resource schema.", "resourceName");
            }

            ResourceDefinitions.Add(resourceName, resourceDefinition);

            return(this);
        }