dodyg / practical-aspnetcore

Practical samples of ASP.NET Core 9 RC1, 8.0, 7.0, 6.0, 5.0, 3.1, 2.2, and 2.1,projects you can use. Readme contains explanations on all projects.
MIT License
9.16k stars 1.18k forks source link

Using Razor view without MVC #19

Open dodyg opened 8 years ago

dodyg commented 8 years ago

https://github.com/aspnet/Entropy/tree/master/samples/Mvc.RenderViewToString

dodyg commented 8 years ago

http://stackoverflow.com/questions/38247080/using-razor-outside-of-mvc-in-net-core

lohithgn commented 3 years ago

if we are in aspnetcore - you will either be using RazorPages model or MVC model. Both RazorPages & MVC model have Razor engine as the View engine. If we have to showcase Razor outside of MVC - then it has to be non aspnetcore project types. which will defeat the purpose of practical-aspnetcore ?

thoughts ?

dodyg commented 3 years ago

Razor Template Engine is useful beyond just generating string for the view. You can use it to in theory to generate static files or generate emails. These are activities that are within the realm of people using ASP.NET Core for. The problem is that Razor Template Engine is too highly coupled with MVC which creates problems.

Razor will have a new architecture in .NET 6. It's an opportunity to take a look at this idea once again to see if it is better.