0

So we have a very large ASP.NET WebForms applications (Recently updated to .NET 4.0), and I want to attempt to put MVC in alongside it.

I've read lots of articles around the fact that the 2 types of applications do sit well beside each other. However, the current site makes heavy use of Spring.NET.

Ideally, all I want to do is start adding MVC pages to it, utilising the existing configuration of the business logic.

I've tried just using the MvcContextHandler, however, this leads to errors (The virtual path '/currentcontext.dummy' maps to another application, which is not allowed.) so I'm thinking that it's not as easy as that.

The reason I want to utilise the existing objects is that these will contain context information about the user, and what they've previously selected in the flow, so utilising the existing class that have been instantiated would be very useful.

So does anyone know if this is possible, and if so, are there any resources around to show how to do it?

I'm currently thinking that chaining IoC containers might be an option, so resolving controllers using Ninject, so the parameters are mapped to get the dependencies from the Spring container, but that seems like a long way around...

3
  • We upgraded a medium LOB-app to MVC3/Spring.Net and retained the analytics part written in Asp.Net WebForms (Telerik controls, reporting services), so it is possible. Imho I did not use the MVC3 support facilities brought with Spring.Net and instead wrote a new one. At that time MVC3 was quite new the documentation that ultimately helped was: bradwilson.typepad.com/blog/2010/10/… Commented Oct 29, 2013 at 8:39
  • @Andreas, that link was helpful, and it is what I used to add the dependency resolver. if you put is as an answer, I'll accept it. Commented Apr 27, 2014 at 12:57
  • Added the comment as answer, cool that it helped. Commented Apr 29, 2014 at 20:30

1 Answer 1

1

We upgraded a medium LOB-app to MVC3/Spring.Net and retained the analytics part written in Asp.Net WebForms (Telerik controls, reporting services), so it is possible.

Imho I did not use the MVC3 support facilities brought with Spring.Net and instead wrote a new one. At that time MVC3 was quite new the documentation that ultimately helped was:

http://bradwilson.typepad.com/blog/2010/10/service-location-pt5-idependencyresolver.html

According to Brad, to implement a dependency resolver for MVC, you will need to implement this interface:

public interface IDependencyResolver {
  object GetService(Type serviceType);
  IEnumerable<object> GetServices(Type serviceType);
}

http://msdn.microsoft.com/en-us/library/system.web.mvc.idependencyresolver.aspx

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.