Registering Controllers using AutoFac in an ASP.NET MVC2 application with Areas - asp.net-mvc

Has anyone been able to get AutofacControllerFactory working in applications where the controllers are split into Areas?
Looks like it is not supported out of the box in the current version.
Thanks

I'm afraid I can't offer a solution for AutoFac, but perhaps you could consider using Ninject (Github Download) instead? It does work with areas if you grab the latest Ninject MVC extension build from Github.
At the time of this posting there is a small bug in the MVC extension which sometimes causes types to get double-registered and results in controller resolution errors. The quick fix is to simply rebuild the application pool in IIS. Having spoken with the developer recently, it sounds like they've gotten the problem tracked down and it's just a matter of time before they update the sources.

Related

Issue with Visual Studio 2013, MVC 4.0 application and Web API 2.2 Nuget Package Install

I have a standard MVC 4.0 project for my application which was working correctly. I needed to use WebAPI within the same project so I installed the Nuget Package for WebAPI 2.2.
All seemed well and WebAPI ran fine after some tests, and my project also ran fine, except for the fact that now I cannot add standard MVC controllers, they all refer to adding a WebAPI controller and also options to add a standard view from an action inside a standard MVC controller using the Right Click context menu are now missing.
It seems as if it is assuming it is a WebAPI project only now, however I still need all MVC related options to be present. I am using Visual Studio 2013.
Any advice on this appreciated.
I believe it is not possible to use both WebAPI and MVC in the same project.
I managed to get it pretty much working using two projects in the same solution e.g. MyProject.MVC project and MyProject.API. However this turned out to be a bit clumsy, the biggest issue for me was getting Unity to work for both cases. Eventually I got that working too, but after a few days I figured I didn't actually need the WebAPI portion and it was causing more work than it was worth, so I removed that from the solution.
Not sure this answers your question tbh, but hopefully useful in some way. Btw in the next version of MVC6 (vNext) they are apparently planning to combine the Mvc and WebApi parts into a single framework, so this should ease the pain!

Is there an official page for ASP.NET MVC Futures?

I am planning to integrate Mvc.Futures in my project, but am unable to find any official documentation for this library.
Official project page on nuget.org points to old asp.net project page on codeplex and even there is not so clear where information about Futures can be found.
I might be missing something, but would appreciate if anyone can give me pointers to the right place.
Thanks.
This is follow up on my own question:
I haven't found anything else related to Mvc.Futures after i posted this question, so i ended up using T4MVC which seem to get more love from MSFT than the Futures itself (lead developer of this template is MSFT employee David Ebbo).
We are using it quite successfully so far (more than 8 months) and i am pleased with the results.
For better integration with Visual Studio i am using AutoT4MVC extensions which runs the T4 templates on each change in the sections of the MVC app that require rebuild (such as Controllers, Content*, Views etc..)
To sum up - i would suggest that you stay out of Mvc.Futures for now and use T4MVC instead.

Problem with MVC3 updgrade. Update to MVC3 from MVC2 Web App Solution, possible?

I tried upgrading the solution to MVC3 in VS2010 by using an upgrader tool
I don't know what it does exactly but it didn't work. My "System.Web.Mvc" is not being recognized in my project.
Is there anything specific I should be doing with my web.config? I don't quite understand the underlying details about all the places I should be referencing dll's or what "binding" even means and when I should use it inside the web.config
So I have to ask, what is the best method for upgrading to MVC3 and what have you done that works?
Thanks a bunch friends.
You mean the reference? What happens if you delete the reference from the project and add it back from the file location where you installed MVC3?

does nhibernate.burrow work with mvc.net and dot net 4.0 framework

I am thinking of using nHibernate.Burrow in my mvc.net application. However there are several troubling things that I have read and I am hoping to get them sorted out before I embark on the project:
Are there any issues with running .Burrow with mvc.net?
Are there issues with running .Burrow with the 4.0 framework?
How tightly coupled is .Burrow with the nHibernate? I have read several things indicating that I have to use the same version of nHibernate as was used to create the .Burrow binaries.
Any other thoughts that people have?
Yes, you should use Burrow with appropriate NHibernate version. If you want to use it with another one you can try to put assemblyRedirect in web.config file.
And I wouldn't try to use Burrow with MVC. Yes, it has Session magement and some other usefull featrures, but they are tied to ASP.NET Web Forms.
As a base framework for mvc applications I would suggest Sharp Architecture. It has all required binaries and all versions are latest.

ASP.NET MVC 1 and 2 on Mono 2.4 with Fluent NHibernate

I'd like to create an application using ASP.NET MVC, that should run under mono 2.4 (compiling will be done on a Windows box). Has anyone getting luck with this? Here is what I've already tried:
ASP.NET MVC on mono without any persistence model support, and using nhaml as the view engine
S#aml architecture, which is a quite good framework imho, but it depends too much on stuff, that are not working good under mono (like windsor)
The first part worked fine, I didn't encounter any major problems. But I couldn't get the second part working. It seems it's dependency on Castle.Windsor breaks the whole mono support (but there might be other parts too).
Therefore I decided to create an alternative framework, that borrows some of the ideas of s#arp-architecture, but designed to be working under mono (and if I'm able to do this I'll release it for the community of course). The controller and view part is working fine (not much magic here though, they have been always working), but I have some questions before I start job on the persistence part:
What NHibernate versions are working under mono? I've heard 1.2 is working fine. Does 2.0.1/2.1 beta work under mono?
Does Fluent.NHibernate and NHibernate.Linq work under mono? (for the latter it seems it needs some dependcies that aren't avaialable in mono)
Are there any good alternatives for persistence support to NHibernate under mono?
Alternative questions:
Are there any frameworks that have mono+persistence+asp.net mvc support already or am I the first one to think about this?
If you have already done this: what are your opinions on stability/usability?
Thanks for the answers
EDIT: Updated the framework to support ASP.NET MVC 2: http://shaml.sztupy.hu/
I am using mono 2.4 to run a asp.net mvc app + windows service.
Compatibility is very good. There are some bugs and differences than with windows but once you learn what they are it gets easier (there can be pain at the start!)
I am using NHibernate (2.1) FluentNhibernate, StructureMap, NBehave, Moq and open id lib and they all just seem to work as expected.
As for stability, since I have ironed out the major bugs in my code I haven't had any problems.
Usability, well it is a completely different platform so you need to come to it with an open mind and be prepared to leave behind the windows way.. the good news is that once you do that things get easier. Apache is a lot nicer than IIS and configuring and managing a linux box is just easier than windows.
I am pretty glad I choose mono.. sorry this is starting to sound like a PR drive - but I am just really happy with it!!
Okay. I started on a new project that incorporates the best from S#arp Architecture with stuff, that work on mono. Instead of T4Toolkit it uses a ruby script to do the generation job, just as with rails or merb.
To use install the shaml gem from github:
gem install shaml
Then create a new application:
shaml generate app AppName
And create resources:
shaml generate resource NewRes "name:string;date:DateTime"
S#aml Architecture project homepage: http://shaml.sztupy.hu/
GitHub project: http://github.com/sztupy/shaml/tree/master

Resources