public void DecorateProperty(CodeMemberProperty propertyDefinition, KeyValuePair<string, JsonSchema> propertyPair)
        {
            propertyDefinition.ThrowIfNull("propertyDefinition");
            propertyPair.ThrowIfNull("propertyPair");

            propertyDefinition.Comments.AddRange(CreateComment(propertyPair.Value));
        }
        public void DecorateProperty(CodeMemberProperty propertyDefinition, KeyValuePair <string, JsonSchema> propertyPair)
        {
            propertyDefinition.ThrowIfNull("propertyDefinition");
            propertyPair.ThrowIfNull("propertyPair");

            propertyDefinition.Comments.AddRange(CreateComment(propertyPair.Value));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Creates a new resource for the specified discovery version with the specified name and json dictionary.
        /// </summary>
        internal BaseResource(DiscoveryVersion version, KeyValuePair<string, object> kvp)
        {
            kvp.ThrowIfNull("kvp");
            kvp.Key.ThrowIfNull("kvp");

            DiscoveryVersion = version;
            logger.Debug("Constructing Resource [{0}]", kvp.Key);
            Name = kvp.Key;
            information = kvp.Value as JsonDictionary;
            if (information == null)
            {
                throw new ArgumentException("got no valid dictionary");
            }

            // Initialize subresources.
            if (information.ContainsKey("resources"))
            {
                var resourceJson = (JsonDictionary)information["resources"];
                resources = new Dictionary<string, IResource>();
                foreach (KeyValuePair<string, object> pair in resourceJson)
                {
                    // Create the subresource.
                    var subResource = (BaseResource)CreateResource(pair);
                    subResource.Parent = this;
                    resources.Add(pair.Key, subResource);
                }
            }
        }
Ejemplo n.º 4
0
 public void SetWorkDistributor(KeyValuePair <Type, IWorkDistributor> pair)
 {
     pair.ThrowIfNull(nameof(pair));
     pair.Key.ThrowIfNull(nameof(pair.Key));
     WorkDistributors.Add(pair.Key, pair.Value);
 }