ASP.NET MVC and F# Service
My solution is split into 3 projects. Model, Services and Web. In my Service project, I'd like to use some F# features in it. Whats the best way to use 2 separate 开发者_运维问答service projects, one for C# and one for F# and how would I structure these projects?
I think that the best option would be to split your Services project into:
- Main C# project (especially if it contains some designer generated code)
- An implementation F# library that is built using F# and exports the important algorithms in module or as classes (with a C# friendly interface).
This way you can use C# designers (which are generally not available for F#), but implement all the complicated functionality in F#. This approach is actually quite similar to the one I recomended recently on my blog when developing ASP.NET MVC applications in F#. The main application is written in C#, but all the interesting functionality is moved to an F# library and then used from C#.
Using ILMerge
tool to merge two assemblies (as mentioned in the other referenced answer) may work, but it won't give you much benefits (the C# and F# parts won't be able to mutually reference each other), so it is essentially the same as having C# project + F# library.
精彩评论