public static ComplexType FromXml(XElement xml) { if (xml.Name.LocalName != ElementName) throw new ArgumentException("xml was not a ComplexType element"); var obj = new ComplexType { Name = xml.AttributeValue("Name") }; obj.Properties.AddRange(from e in xml.Elements() where e.Name.LocalName == "Property" select Property.FromXml(e)); return obj; }
private static string BuildJsonExample(ComplexType ct, IEnumerable<Schema> otherSchema) { Dictionary<string, object> dict = BuildDictionaryExample(ct, otherSchema); return JsonConvert.SerializeObject(dict); }
private static Dictionary<string, object> BuildDictionaryExample(ComplexType ct, IEnumerable<Schema> otherSchema) { return ct.Properties.Where(prop => prop.Type != "Edm.Stream").ToDictionary(prop => prop.Name, prop => ExampleOfType(prop.Type, otherSchema)); }
private static ResourceDefinition ResourceDefinitionFromType(Schema schema, IEnumerable<Schema> otherSchema, ComplexType ct) { var annotation = new CodeBlockAnnotation() { ResourceType = string.Concat(schema.Namespace, ".", ct.Name), BlockType = CodeBlockType.Resource }; var json = BuildJsonExample(ct, otherSchema); ResourceDefinition rd = new JsonResourceDefinition(annotation, json, null); return rd; }
internal void RenameEntityType(ComplexType renamedType) { // renamedType could be ComplexType or EntityType this.RenameTypeInObjectGraph(renamedType.WorkloadName, renamedType.Name); }
private static Dictionary <string, object> BuildDictionaryExample(ComplexType ct, IEnumerable <Schema> otherSchema) { return(ct.Properties.Where(prop => prop.Type != "Edm.Stream").ToDictionary(prop => prop.Name, prop => ExampleOfType(prop.Type, otherSchema))); }
private static string BuildJsonExample(ComplexType ct, IEnumerable <Schema> otherSchema) { Dictionary <string, object> dict = BuildDictionaryExample(ct, otherSchema); return(JsonConvert.SerializeObject(dict)); }
private static ResourceDefinition ResourceDefinitionFromType(Schema schema, IEnumerable <Schema> otherSchema, ComplexType ct) { var annotation = new CodeBlockAnnotation() { ResourceType = string.Concat(schema.Namespace, ".", ct.Name), BlockType = CodeBlockType.Resource }; var json = BuildJsonExample(ct, otherSchema); ResourceDefinition rd = new ResourceDefinition(annotation, json, null, "json"); return(rd); }