fixing error in mvc4 webapi dependencyresolver impl dispose process

This commit is contained in:
Steve Bohlen
2012-06-22 16:17:15 -04:00
parent 440eea1fb1
commit 860c097eb6
4 changed files with 73 additions and 6 deletions

View File

@@ -8,6 +8,9 @@
<object type="Spring.Mvc4QuickStart.Controllers.SuffixController, Spring.Mvc4QuickStart" singleton="false" >
<property name="Suffix" value="_Spring.NET_was_Here!" />
</object>
<object type="Spring.Mvc4QuickStart.Controllers.OdataController, Spring.Mvc4QuickStart" singleton="false" />
<!--intentionally do NOT register the AccountController or the ValuesController with the container; demonstrates that the underlying
default controller factory will properly (attempt to!) resolve all controllers not registered with Spring.NET

View File

@@ -0,0 +1,51 @@
using System.Collections.Generic;
using System.Linq;
using System.Web.Http;
namespace Spring.Mvc4QuickStart.Controllers
{
public class OdataController : ApiController
{
// GET /api/odata/5
public string Get(int id)
{
return "value";
}
// GET /api/odata?$skip=1&$top=2
// GET /api/odata?$filter=SomeProperty%20eq%203
[Queryable]
public IQueryable<SampleDataItem> Get()
{
var campaigns = new[]
{
new SampleDataItem { SomeProperty = 1 },
new SampleDataItem { SomeProperty = 2 },
new SampleDataItem { SomeProperty = 3 },
new SampleDataItem { SomeProperty = 4 },
};
return campaigns.AsQueryable();
}
// POST /api/odata
public void Post(string value)
{
}
// PUT /api/odata/5
public void Put(int id, string value)
{
}
// DELETE /api/odata/5
public void Delete(int id)
{
}
}
public class SampleDataItem
{
public int SomeProperty { get; set; }
}
}

View File

@@ -59,14 +59,24 @@
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Core" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Http, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Http.WebHost, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Deployment, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System.Web.WebPages.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Web" />
<Reference Include="System.Web.Extensions" />
@@ -112,6 +122,9 @@
<Compile Include="App_Start\RouteConfig.cs" />
<Compile Include="Controllers\AccountController.cs" />
<Compile Include="Controllers\HomeController.cs" />
<Compile Include="Controllers\OdataController.cs">
<SubType>Code</SubType>
</Compile>
<Compile Include="Controllers\ValuesController.cs" />
<Compile Include="Controllers\SuffixController.cs" />
<Compile Include="Global.asax.cs">

View File

@@ -28,7 +28,7 @@ namespace Spring.Web.Mvc
/// </summary>
public virtual void Dispose()
{
if (ApplicationContext != null) ApplicationContext.Dispose();
//no unmanaged resources to dispose
}
/// <summary>