Search code examples
xmlservicestackormlite-servicestack

ServiceStack dynamic result set to xml


I have a problem with two ServiceStack "dynamic" query that basically do the same thing:

var results = Db.SqlList<Dictionary<string, object>>("SELECT * FROM TableName");

and the Dapper equivalent:

IEnumerable<dynamic> results = Db.Query("SELECT * FROM TableName");

They work right if I request a JSON response but they rise a 500 Server Error (IIS) if I request an XML response. Which is the difference? Isn't just a different way to present the same data?


Solution

  • Many serializers do not support object or dynamic types, which is why mapping them to clean POCO's is always preferred.