Issue with extending OData by creating a custom OData formatter

Topics: ASP.NET MVC, ASP.NET Web API
Jan 20, 2014 at 4:19 PM
Edited Jan 20, 2014 at 7:02 PM
Based on information given at https://aspnetwebstack.codeplex.com/wikipage?title=OData%20formatter%20extensibility we tried to extend OData by creating own custom OData formatter.
Everything works now as expected except performance: a query to a database with many columns takes more than 10 or 15 seconds.
Our implementation consists of a custom ODataSerializerProvider that extends DefaultODataSerializerProvider and has a custom ODataEntityTypeSerializer with public override ODataEntry CreateEntry(SelectExpandNode selectExpandNode, EntityInstanceContext entityInstanceContext) method where we have our logic which changes an instance of SelectExpandNode (we replace names of columns there)

If we call a default implementation of DefaultODataSerializerProvider, results seems to be in cache after the first execution so the performance is ok. Even if we call our custom implementation with the base logic, where we just call :
        var entryTest = base.CreateEntry(selectExpandNode, entityInstanceContext);
        return entryTest;
the performance in this case is poor, it takes 2 or 3 seconds, default response comes in a less then 1 second.

Do we miss something?
Jan 21, 2014 at 12:36 PM
Sorry, that was my fault: injecting ILog and logging was an issue , performance loss had nothing to do with our custom ODataSerializerProvider
Marked as answer by boriska002 on 1/21/2014 at 4:36 AM
Coordinator
Jan 24, 2014 at 3:59 AM
Thanks for updating this answer and helping us avoid the wild goose chase :)