private static void NestedObjects() { ChoETLFrxBootstrap.IsSandboxEnvironment = true; StringBuilder sb = new StringBuilder(); TRoot root = new TRoot() { Client = "ABC", Deals = new List <TDeal>() }; root.Deals.Add(new TDeal { DealName = "59045599", TShape = new List <TInterval>() { new TInterval { StartDate = DateTime.Today.ToString(), EndDate = DateTime.Today.AddDays(2).ToString(), Volume = "100" }, new TInterval { StartDate = DateTime.Today.ToString(), EndDate = DateTime.Today.AddDays(2).ToString(), Volume = "200" } } }); using (var w = new ChoCSVWriter(sb).WithFirstLineHeader()) { w.Write(root.Deals.SelectMany(d => d.TShape.Select(s => new { ClientName = root.Client, DealNo = d.DealName, StartDate = s.StartDate, EndDate = s.EndDate, Volume = s.Volume }))); } Console.WriteLine(sb.ToString()); }
private static void NestedObjects() { TRoot root = new TRoot() { Client = "ABC", Deals = new List <TDeal>() }; root.Deals.Add(new TDeal { DealName = "59045599", TShape = new List <TInterval>() { new TInterval { StartDate = DateTime.Today.ToString(), EndDate = DateTime.Today.AddDays(2).ToString(), Volume = "100" }, new TInterval { StartDate = DateTime.Today.ToString(), EndDate = DateTime.Today.AddDays(2).ToString(), Volume = "200" } } }); using (var w = new ChoCSVWriter("nestedObjects.csv").WithFirstLineHeader()) { w.Write(root.Deals.SelectMany(d => d.TShape.Select(s => new { ClientName = root.Client, DealNo = d.DealName, StartDate = s.StartDate, EndDate = s.EndDate, Volume = s.Volume }))); } }
private static void ExtensionProperty_SupportsWritingToCustomSerializerWithExplicitConverterInternal <TRoot, TDictionary>() where TRoot : IClassWithOverflow <TDictionary>, new() where TDictionary : new() { var root = new TRoot() { Overflow = new TDictionary() }; string json = JsonSerializer.Serialize(root); Assert.Equal(@"{""MyCustomOverflowWrite"":""OverflowValueWrite""}", json); }
public RootLinkData(TRoot root) { _root = root; }
public RootLinkData(PathLinkProviderBase <TValue, TRoot> linkProvider, TRoot root) : base(linkProvider) { _root = root; }