.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

IoC Changes in MVC 3 Beta

Posted By:      Posted Date: October 11, 2010    Points: 0   Category :ASP.Net


I was using the IServiceLocator in MVC 3 Preview 1 but now with Beta everything is changed. I am using StructureMap for IOC.

I am not able to find a code example with implementation about this and I am quite lost.

Does anyone knows how this should be changed?

The following code was what I was using (ServiceLocator + ControllerFactory + FilterProvider):


  public class ServiceLocator : IMvcServiceLocator {

    const String HttpContextKey = "__StructureMapServiceLocator_Container";
    private readonly IMvcServiceLocator _default;
    private readonly IContainer _container;

    protected Container Container {
      get {
        if (!HttpContext.Current.Items.Contains(HttpContextKey)) {
          HttpContext.Current.Items.Add(HttpContextKey, Container);
        return (Container)HttpContext.Current.Items[HttpContextKey];

    public ServiceLocator() {

      ServiceLocator locator = MvcServiceLocator.Current as ServiceLocator;
      if (locator != null)
        _container = locator.Container;

      _default = MvcServiceLocator.Default;

    } // ServiceLocator

    public ServiceLocator(IContainer container)
      : this(container, MvcServiceLocator.Default) {
    } // ServiceLocator

    public ServiceLocator(IContainer container, IMvc

View Complete Post

More Related Resource Links

ASP.NET 4 and Visual Studio 2010 Web Development Beta 2 Overview

Many exciting changes for ASP.NET are coming in the .NET Framework version 4. This document gives an overview of many of the new features that are included in the Beta 2 release of the .NET Framework 4 and of Visual Studio 2010.

Visual Studio 2010 Beta 2

This is a big deal. This isn't ".NET 3.6" - there are a lot of improvements of .NET 4, and it's not just "pile on a bunch of features so you get overwhelmed." I've been working with and talking to many of the teams involved and even though it's a cheesy thing to say, this is a really customer-focused release.

ASP 4 - Whirlwind Tour around .NET 4 (and Visual Studio 2010) Beta 1

There's a lot of stuff that's new and added in .NET 4, but not in that "overwhelming-I-need-to-relearn-everything" way. More in that, "oh, this is way easier/simpler now" way. Like, moving data around with ADO.NET DataServices is easy, binding with client templates is easy, there's F# if you need it, the "dynamic" keyword if you need it, Silverlight's already installed, oh, and the parallel stuff will freak you out, but in a good way.

Service Station: Developing .NET Web Services with Beta 2


Version 2. 0 of the Microsoft® . NET Framework makes numerous improvements at various levels in the Web services protocol stack. In addition, better tool support and an increased focus on interoperability make your life easier.

Aaron Skonnard

MSDN Magazine April 2005

.NET Migration Case Study: Using ASP.NET to Build the beta.visualstudio.net Web Site


When the Web site used to collect customer feedback about the Visual Studio .NET beta needed an update, the Visual Studio team saw a good opportunity to implement, deploy, and showcase a real-world site using .NET technologies. This article covers the migration of the Web site, beta.visualstudio.net, from components written in Visual Basic 6.0 and ASP hosted on Microsoft Internet Information Services (IIS) 5.0 to ASP.NET and the .NET Framework. The choices of technologies to be incorporated, along with issues such as validation, security, and authentication, are all discussed. Both existing components and the new components written in JScript and ASP.NET that were used to migrate the site are also explained.

Jay Schmelzer

MSDN Magazine September 2001

V1.1 to Beta 2 - Namespaces Not Recognized


We are attempting to test out a website written in VS2003/.Net 1.1 in VS2005 Beta 2/.Net 2.0.  Our main problem at this point is that certain classes are not being recognized when they are referenced in other files not in the same directory as the class file.


A Framework.cs file under \Applications is inherited by several other webpages. It resides under the namespace Company.WebSite.Applications.

Another class, SearchHistories, is in \Applications\CrackHistory directory. The namespace of SearchHistories class is Company.WebSite.Applications.CrackHistory. SearchHistories inherits Framework.  Under .NET1.1, there was no problem with this. However, in VS2003, a compile error states "The type or namespace name 'Framework' could not be found (are you missing a using directive or an assembly reference?) C:\WEB\Applications\CrackHistory\SearchHistories.aspx.cs".

The immediate solution is to copy the Framework.cs file from the Applications directory and copy it into the Applications\CrackHistory directory. Then the error goes away. What is up with that?

Microsoft SharePoint Designer 2010 Beta (32-bit) - Now Available!

Using SharePoint 2010 Designer, advanced users and developers alike can rapidly create SharePoint solutions in response to business needs. In addition, developers can use SharePoint Designer 2010 to get a quick start on SharePoint development projects.

Microsoft SharePoint Designer 2010 Beta (64-bit) - Now Available!

Using SharePoint 2010 Designer, advanced users and developers alike can rapidly create SharePoint solutions in response to business needs. In addition, developers can use SharePoint Designer 2010 to get a quick start on SharePoint development projects.

Microsoft SharePoint Foundation 2010 Beta - Now Available!

This download contains an installable version of SharePoint Foundation 2010 Beta that can be used to assess and test the new functionality in this release. SharePoint Foundation 2010 is the new version of Windows SharePoint Services.

Microsoft SharePoint Server 2010 Beta - Now Available!

SharePoint 2010 provides a robust development platform to rapidly build solutions using familiar tools like Visual Studio 2010 and SharePoint Designer 2010. Developers gain access to a rich set of out-of-the-box features such as Business Connectivity Services for read/write integration between application data, the web and Office 2010 client.

Can not enable RBS on sharepoint 2010 beta 2

I installed Sharepoint 2010 beta 2 on Windows 2008 sp2, use standalone mode, then configuration RBS according the document http://technet.microsoft.com/en-us/library/ee663474(office.14).aspx, but when I want to use Power shell enable rbs, it will throw error:PS C:\> $rbss.Installed()TruePS C:\> $rbss.Enable()Exception calling "Enable" with "0" argument(s): "SQL remote blob storage mustbe installed on each web front end server and on the content database before it may be used."At line:1 char:13+ $rbss.Enable <<<< ()    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException    + FullyQualifiedErrorId : DotNetMethodExceptionis there anybody meet the same issue with me? does anybody know how to resolve this issue? thanks very much.

maintainscrollpositiononpostback is not working in Google Chrome 5.0.353.70 beta

All --I think that sometimes maintainscrollpositiononpostback is not working in Google Chrome 5.0.353.70 beta.Has anyone else experienced this?Does anyone have a fix for this?Does anyone have an alternative for this?Please advise.Thank you.-- Mark Kamoski

MS Visual STudio 2010 Beta and SSIS Designer - BI Development Studio

Hello, I am trying to use SSIS Designer with BI Development Studio.  I downloaded MS Visual Studio 2010 Beta and do not find an option to get into either the SSIS Designer or BI Development Studio. Can someone please help?   Thanks, Chela 

Product Availability and Links to available RTM products (free and trial versions) and to Beta versi

[This sticky post is to avoid any more people asking. It will be updated.]  RTM information: ----------------------------- RTM: 16th April 2010 MSDN and TechNet Availability: 22nd April 2010: SharePoint Server 2010. 3rd May 2010: Search Server 2010. 3rd May 2010: FAST Search Server 2010. Free Products Availability: 22nd April 2010 - SharePoint Foundation 2010: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=49c79a8a-4612-4e7d-a0b4-3bb429b46595 - SharePoint Designer 2010 64-bit: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=566d3f55-77a5-4298-bb9c-f55f096b125d - SharePoint Designer 2010 32-bit: http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=d88a1505-849b-4587-b854-a7054ee28d66 5th May 2010 (officially) Microsoft Search Server 2010 Express: http://www.microsoft.com/downloads/details.aspx?FamilyID=cea31a4f-a8b4-4864-b520-be612becdcfa&displaylang=en 12th May 2010 - SharePoint Foundation 2010 Language Packs:  http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=646e311a-aaf3-4d30-b03c-2f3c70d19a22 - SharePoint Server 2010 Language Packs:  http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=046f16a9-4bce-4149-8679-223755560d54 Note: These are in both cases only for the initial small batch of languages and e

Implementing Cumulative Beta Distribution function in Sql server 2005.

Hi,   I am trying to implement BETADIST function which is present in Excel through Sql Server Integration Services(SSIS). Can any body help me on this.   Thanks in advance, Prasad Palaparthy.

The provider reported an unexpected catestrophic failure using BETA MICROSOFT.ACE.OLEDB.14.0 drivers

I'm just in the process of converting my app to be able to support text importing via "OPENROWSET" in 64 bit SQL Server using the Beta MICROSOFT.ACE.OLEDB.14.0 drivers.  I've previously used the MICROSOFT.ACE.OLEDB.12.0 drivers but of course these only work on 32 bit instances of SQL Server.  I've found that after I've installed the beta that the connections wont work if I use MICROSOFT.ACE.OLEDB.14.0 as the provider.  However if I use MICROSOFT.ACE.OLEDB.12.0 it works... sort of... I can import data a few times then I get a "The provider reported an unexpected catestrophic failure" error and the app hangs.My environment is 64-bit Windows 7 running VM Workstation, with a 64-bit Windows 7 guest running SQL Server 2008 64 Bit.  Essentially I'm running the following which works... occasionally getting the failure above select top 50 * FROM OPENROWSET('Microsoft.ACE.OLEDB.12.0','Text;Database=c:\temp\captell;HDR=Yes', 'SELECT * FROM [DASDGIGS0013046591395.TXT]')and select top 50 * FROM OPENROWSET('Microsoft.ACE.OLEDB.14.0','Text;Database=c:\temp\captell;HDR=Yes', 'SELECT * FROM [DASDGIGS0013046591395.TXT]')Which doesn't work, returning the "OLEDB provider ... has not been registered" message.So I'm thinking that the drivers are 64-bit drivers but the registration process during installation is using
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend