Replies: 4 comments 12 replies
-
Declare the HttpContext as a settable property and make sure it gets set? I'm not sure what you are trying to model, but it doesn't work. Those method exist on |
Beta Was this translation helpful? Give feedback.
-
@davidfowl, I'm trying to use composition in our API layer with minimal boilerplate code. The main discussion is here. We can't have a fat God-object base class to inherit from. Let's say I want to create a controller that represents a tree, caches the output, needs to be behind the sign-in, and is searchable. Let's call it
|
Beta Was this translation helpful? Give feedback.
-
In ASP.NET Core, default interface methods cannot directly access In your controllers, you can inject IExcelExporter and use the extension method:
|
Beta Was this translation helpful? Give feedback.
-
@XGavinp, that's exactly the problem. Tons of boilerplate for a simple composition requirement and very little maintenance value and change flexibility. Please see my arguments here. Multiply those 5 or more boilerplate codes by 500 APIs and you definitely realize how inefficient this syntax is. And please don't become sad by my sad or angry words. I'm thankful for your help. I'm just tired of .NET team refusing to add a graceful composition capability to .NET. |
Beta Was this translation helpful? Give feedback.
-
I want to create an interface with default methods to share it between my controllers. Let's say it's called
IExcelExporter
.What options do I have to access
HttpContext
and other required stuff for the web here?Beta Was this translation helpful? Give feedback.
All reactions