Esempio n. 1
0
 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;
 }
Esempio n. 2
0
 private static string BuildJsonExample(ComplexType ct, IEnumerable<Schema> otherSchema)
 {
     Dictionary<string, object> dict = BuildDictionaryExample(ct, otherSchema);
     return JsonConvert.SerializeObject(dict);
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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;
 }
Esempio n. 5
0
 internal void RenameEntityType(ComplexType renamedType)
 {
     // renamedType could be ComplexType or EntityType
     this.RenameTypeInObjectGraph(renamedType.WorkloadName, renamedType.Name);
 }
Esempio n. 6
0
 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)));
 }
Esempio n. 7
0
        private static string BuildJsonExample(ComplexType ct, IEnumerable <Schema> otherSchema)
        {
            Dictionary <string, object> dict = BuildDictionaryExample(ct, otherSchema);

            return(JsonConvert.SerializeObject(dict));
        }
Esempio n. 8
0
        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);
        }