Dude, great video, very nice simple breakdown. I came across the concept when I used to work in Spring/Java and was delighted to find out .NET has a comparable feature. Very well presented, I feel like I have a base-level working understanding of the implementation now, as I go return to the documentation. You've got my sub!
What a wonderful video, thank you so much for taking the time to put it together. It was clear and well explained, one of the best I've seen, and I've seen a lot. Well done again. I appreciate your work. It's the first video of yours I've seen and I've already subscribed. I'm really looking forward to watching more of then. You mentioned that you could make a video going into some more of the concepts you covered. I'd appreciate that very much when you have the time. All the best!
Thank you so much for sharing this video. I always want to know what's the different between exception filter and exception middleware before watching this video, In short, We can only access Httpcontext in exception middleware directly, But in exception filter, Microsoft writes a lot of methods in ExceptionContext, We can more easily to use these methods to achieve what we want in our project.
Great video, you know a lot! You pick my interest when mentioning the different exception strategies in layer. Also, I added the "filter exception" portion (based on what you explained) to my project, so am I missing something else, or this is it? Thank you for the videos, I am learning a lot from you.
I watched your video and learned petty good. I would you like you to create common response class for all the request in project. If possible plz post that video. Thanks
@@Codewrinkles actually I had question about Middlewares and Action Filters on the interview. So your video was more than helpful. Waiting for the decision of company
I guess that would be possible. The advantage for this is that you would also catch exceptions generated after the exception filter creates the response. This could happen if the response travels through different middleware components that perform logic based on the response and one of them might throw an error. What I found out so far is that if you are not using custom middleware on the pipeline, then this approach wouldn't bring much value.
Exception Middleware came later before exception filters exists... As u have concluded that exception filters is best to use compared to middleware..is there any specific reason when it is suitable to use Middleware than filters??
I don't recall to have said that it's better generally. I have compared both, I have showed what information we have available in each of them and my conclusion was that I found filter more suitable. Therefore, that's whay I'm using in all my projects. My main argument for this is that filters are part of the action executing pipeline and therefore you have access to information that you don't have in the middleware. Or, at least, not easily accessible.
Greetings from Bulgaria. Great tutorial and work. Thank you, Please consider my question. On your schematic - should we understand that when using middleware then the request turns around and never continues to the rest of the blocks, like Controls creation, Auth. filters, etc. Thank you.
Well, that still needs to be implemented in a middleware, right? At least that's how I've seen it implemented and can't imagine how it would work otherwise. I guess that would be useful when we expect a certain type of exception. But the point I made in the video is that in an exception filter you have access to more contextual information. And I guess this still applies. I'm curious to hear your opinion on this.
@@Codewrinkles With an exception filter you can indeed access the http context, routing and more. Since this does not apply to middleware I made the point of using IExceptionHandlerFeature in middleware to not only return a status code 500 but to dig deeper into the exception that occurred, either as info for the user or to log the exception and more
You need to add it everywhere which shouldnt be done (in most of the cases). Moreover you also need to consider scenario when one of your junior team mate forgets to add exception handling in your api endpoint Global exception filter or middleware comes in handy then
@@hassanarafat6430 let's suppose an exception occurs in the sevice layer. Can we get in which method of service layer exception has occurred by using global exception handling?
@@hassanarafat6430 i think with that too we can only track action name, not the name of the method in service layer or any other private method in a common layer where actually exception raised.