How do you extend JsonResult? Say I wanted to make a JsonTransactionResult because I want to enforce all of my transactions to return a jsonified TransactionResult object. The TransactionResult object contains data for error messages and stuff. Do I do this via inheritance or wrapping JsonResult?
How do you extend JsonResult ? Say I wanted to make a JsonTransactionResult because
Share
I’d simply inherit from JsonResult and return an instance of the
TransactionResultclass.I have something similar, though I inherit from ActionResult and use JSON.NET, since I had some serialization issues with DateTime using the built in JsonResult.
And then I inherit from that class, to wrap a success property with the result: