public static string Serialize(BISpecification obj) { using (MemoryStream stream = new MemoryStream()) { DataContractJsonSerializer json = new DataContractJsonSerializer(typeof(BISpecification)); json.WriteObject(stream, obj); return(Encoding.UTF8.GetString(stream.ToArray())); } }
public static List <BISpecification> transformFromApp(List <Specification> specs) { List <BISpecification> biSpecs = new List <BISpecification>(); foreach (var spec in specs) { BISpecification biSpec = transformFromApp(spec); biSpecs.Add(biSpec); } return(biSpecs); }
public static BISpecification transformFromApp(Specification spec) { BISpecification biSpec = new BISpecification(); biSpec.Plan = spec.name; biSpec.Version = spec.version; biSpec.Driver = spec.product; if (spec.content != null) { string span = ""; string interval = ""; var biConfigs = extractSpanInterval(spec.content.Configuration, out span, out interval); biSpec.Span = span; biSpec.Interval = interval; biSpec.Configuration = biConfigs as List <ConditionItem>; biSpec.Specification = spec.content.Specification as List <SpecItem>; } return(biSpec); }