Razor.Templating.Core icon indicating copy to clipboard operation
Razor.Templating.Core copied to clipboard

Why 3 overloads for RazorTemplateEngine.RenderAsync?

Open cadilhac opened this issue 2 years ago • 1 comments

Hi,

I have some generic piece of code that calls RazorTemplateEngine.RenderAsync with 3 arguments. But sometimes, model or viewdata could be null. In that case I have a compiler warning. I wonder if this would not be better to have a single signature with 3 arguments where model and viewdata accept null. Otherwise, the client app has to write some "if" code, testing for null and calling the right overload. Just my 2 cents.

cadilhac avatar Apr 20 '22 17:04 cadilhac

Hi, that's a valid concern. I'll see if we can address them in the upcoming releases(without any breaking changes). Thanks.

soundaranbu avatar Apr 28 '22 05:04 soundaranbu

Hey @cadilhac, this is now implemented in https://github.com/soundaranbu/Razor.Templating.Core/releases/tag/v1.8.0-rc.1

Thanks for your valuable suggestion!

soundaranbu avatar Sep 18 '22 05:09 soundaranbu