Using ExpandoObject as an ObjectDataSource with the standalone designer

2 posts, 0 answers
  1. Kevin
    Kevin avatar
    2 posts
    Member since:
    Aug 2017

    Posted 04 Oct 2017 Link to this post


    I am attempting to use the standalone report designer with an Object DataSource that returns ExpandoObject.  I have been following this example to provide a custom type description provider for ExpandoObject:

    However, I am having trouble getting this to work with the standalone designer.  I cannot think of a way to get the custom type description provider registered when running in the context of the standalone designer.  Is there a way to accomplish this (maybe through configuration)?  




  2. Todor
    Todor avatar
    189 posts

    Posted 05 Oct 2017 Link to this post

    Hi Kevin,

    It would be necessary to Extend the Standalone Report Designer with the assembly containing your custom data providing functions. This assembly should be added also to the folder containing the Standalone Designer.
    Note that when using objectDataSource with known properties you would be able to see the properties during design time.
    In the case of ExpandoObject you would not see properties in the Standalone Designer, but they would still be accessible (Fields.PropertyName) if you know their names.

    Here is an example of how the code of the data providing class could look:
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Dynamic;
    namespace ReportLibrary1
        public static class Class1
            static Class1()
                TypeDescriptor.AddProvider(new ExpandoObjectTypeDescriptionProvider(), typeof(ExpandoObject));
            public static IEnumerable GetNames()
                var results = new List<dynamic>();
                dynamic result1 = new ExpandoObject();
                result1.SomeName = "name01";
                dynamic result2 = new ExpandoObject();
                result2.SomeName = "name02";
                dynamic result3 = new ExpandoObject();
                result3.SomeName = "name03";
                return results;
    In the above example Class1 would be the Business Object, and GetNames() would be the data source member. The property SomeName could be accessed as Fields.SomeName from the Standalone Designer.

    Note that the ExpandoObjectType is registered in the constructor of the static data providing class Class1.
    Note also that the assembly that should be added to the Standalone Designer config file should containg
    • the data providing class (Class1 in the snippet)
    • the classes from the article about ExpandoObjects you have referred to
      • ExpandoObjectTypeDescriptionProvider
      • ExpandoObjectTypeDescriptor
      • ExpandoObjectPropertyDescriptor

    Progress Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top