ASP.NET MVC 3: can I combine C # Razor Views with F # controllers?

I believe that this is a direct question, and I think that there is a good chance that the answer is yes (while projects in a mixed language are usually impossible, it seems to me that the View Engine is receiving a special appeal). I know that I could also try this quite easily myself, but for recording and to save some time, I would like to know if this combination is possible (I have not used ASP.NET MVC or Razor yet, I am considering options for a new project at work).

Edit: I am particularly interested in whether this combination is possible within a single project. Or, more specifically, is there any loss in function using this combination (even if two project settings are the way to go).

+4
source share
1 answer

You can mix Razor C # code with F # controllers. Perhaps this can be done in one project (by changing the web project to use F #). A simpler alternative is to create a standard C # Razor web project and a separate F # project (containing the controller model and code).

I created a Visual Studio template that allows you to do just that.

Unfortunately, the template is not yet available in the Visual Studio gallery (so you do not see it on the "Online Templates" tab in the "New Project" dialog box). There is some problem with the loading mechanism that I am trying to solve, so I hope it will appear there soon. There are also several ASP.NET MVC templates from Daniel Mohl in the Visual Studio gallery, but I'm not sure if any of them use Razor.

+6
source

All Articles