What is FastExpando / FastExpandoObject?


I was reading about Dapper and came across a feature of it called FastExpando or FastExpandoObject , I did not understand very well and I had some doubts about this feature.


  • What is FastExpando / FastExpandoObject?
  • What is the relationship FastExpando / FastExpandoObject has with Dapper?
  • asked by anonymous 01.02.2017 / 03:01

    2 answers


    First, in the .NET framework there is the ExpandoObject class , which allows the expansion of an object at runtime.

    ExpandoObject has several uses, one of them is in Database Access, storing the results of a query. The ability to change the object proves to be very useful in this task.

    Dapper, in its own definition, is a simple framework for manipulating objects in .NET, which aims to provide better performance.

    Now about FastExpandoObject , I did not find it in the original Dapper definition (link above).

    I found it in a GitHub repository:

    where it is declared as:

    private class FastExpando : System.Dynamic.DynamicObject, IDictionary<string, object>

    In the SqlMapper.cs of this repository, there is a reference to an old page:

    And this page has an old Dapper package, but it also has no FastExpando definition:

    In conclusion, as the original question that left you with doubt is 2012, I imagine FastExpandoObject is no longer used. And judging by its name, it was meant to be faster than the ExpandoObject.

    Searching on ExpandoObject, I found another class called BetterExpando, which in its definition is "better than expando".

    And there probably should be other classes ...

    03.02.2017 / 13:58

    ExpandoObject are dynamic objects, or be it objects that you can add or remove properties at runtime.

    dynamic meuCache;
    meuCache.QualquerCoisa = "Qualquer coisa mesmo";
    meuCache.OutraCoisa = new { FaladoSerio = true };
    meuCache.MaisUmaCoisa = Enum.Empty<string>();

    Today, the most popular .NET Framework dynamic object is the ViewBag , from ASP.NET MVC .

    In the case of Dapper , it uses dynamic objects to deserialize information that will come from a source where its format is unknown.

    We can see your Dapper application in your class GridReader method .Read(bool)


    class GridReader : The grid reader provides interfaces for reading multiple result sets from a Dapper query


    IEnumerable < dynamic > GridReader.Read (bool) : Read the next grid of results, returned as a dynamic object

    Returning lists is always better than returning tables .

    03.02.2017 / 15:05