我有以下 MVC TypeFormatter 代码,我需要帮助:
将值传递给该对象或从控制器的 get 方法中引用它们
public class ObjectSomeTypeOfFormatter : MediaTypeFormatter { public override Task WriteToStreamAsync(Type type, object value, Stream stream, HttpContentHeaders contentHeaders, TransportContext transportContext) { // Method that I'm overriding where I need to access some variables defined from controller. } }