CarterCommunity / Carter

Carter is framework that is a thin layer of extension methods and functionality over ASP.NET Core allowing code to be more explicit and most importantly more enjoyable.
MIT License
2.1k stars 175 forks source link

Optimized Route Handler #121

Closed RagingKore closed 5 years ago

RagingKore commented 6 years ago

This targets #115. I had a quick look and confirmed what you pointed out @jchannon.

So I moved module, logger and status code handlers resolution out of the route handler.

RagingKore commented 6 years ago

I think the DefaultValidatorLocator could be optimized to resolve map all validators immediately instead of doing it per request and caching.

You not only have a faster first time execution of a request, but you wont need to throw and exception on runtime about having multiple validators for a type.

RagingKore commented 6 years ago

I also have the new proposed DefaultValidatorLocator ready, but unfortunatly, because Carter currently has no way to manually register Validators it is not possible to test the exception.

jchannon commented 5 years ago

Cheers 👍