This is my method, I am trying to validate componentToSave
(or access method parameter values) and throw an exception before method body even runs.
public Component SaveComponent(Component componentToSave) {
...
}
I tried using PostSharp but it is not free and also there were other libraries that rely on AutoFac as IoC but in my current setup I am using dotnet core's built-in dependency injection.
I tried
NConcern
and it relies onCNeptune
andCNeptune
itself relies on a.exe
file for post-compile binding and I currently use Linux for both development and production so I cannot use it, even I tried testing with it on windows but could not get it to work with dotnet core.I tried this approach (i.e.
ActionFilter
andServiceFilter
) but I only got it working if[ServiceFilter(typeof(LoggingActionFilter))]
is over controller not any other method (i.e.SaveComponent
method).I tried using
RealProxy
but apparently, it is not supported in dotnet core.
I am just lost, maybe I am over complicating the problem but there should be a way. Any help would be greatly appreciated.