Neisha Chadwick - 281 - Apr 11, 2014

I want to add some information onto response DTOs of a certain type automatically. I have used a custom ServiceRunner to achieve this, but I am having trouble getting it to work.

Here is my ServiceRunner:
        public override object OnAfterExecute(IRequest requestContext, object response)
            // Called just after any Action is executed
            if (response is IModifyable)
                StaticClass.ModifyResponse(response as IModifyable, requestContext.AbsoluteUri);

            return response;

The custom ServiceRunner is correctly initialized and runs. When I debug I can see my response object is modified (certain fields are populated) correctly, but when I get it back on the other end (ie. in the browser), the extra fields are not there or populated.

What does the Response DTO look like?

Neisha Chadwick:

Ahh the answer was staring me right in the face all along, I knew it! The solution is that I had forgotten to add the DataMember attributes to the additional fields implemented by my interface IModifyable. Thanks Demis!

ok great, sounded like it should be working as expected.