Use dynamic data source in Linq Reporting Engine using C#

Hi,

It has been over 2 years now. Could someone please confirm if we can use dynamics objects reporting engine?

@ravikkashyap

We regret to share with you that there is no update available on this feature at the moment. We will inform you via this forum thread once there is any update available on it.

We apologize for your inconvenience.

@ravikkashyap

Thanks for your patience.

Regarding support of dynamic data sources in LINQ Reporting, we have found a workaround involving recently introduced JsonDataSource and Newtonsoft Json.NET. Please check the following code snippet. Hope this helps you.

// Initialize a dynamic object.
dynamic sender = new ExpandoObject();
sender.Message = "Hello";

// Serialize the dynamic object to JSON.
string json = JsonConvert.SerializeObject(sender);

// Initialize a JSON data source.
MemoryStream jsonStream = new MemoryStream(Encoding.UTF8.GetBytes(json));
JsonDataSource dataSource = new JsonDataSource(jsonStream);

// Create a template document.
DocumentBuilder builder = new DocumentBuilder();
builder.Write("<<[Message]>>");

// Fill the template with data.
ReportingEngine engine = new ReportingEngine();
engine.BuildReport(builder.Document, dataSource);

// Print the result document.
Console.WriteLine(builder.Document.GetText());