Fix MusicStore.Spa:

- Support self-host via commands
- Comment out calls to EF APIs that throw NIE
This commit is contained in:
DamianEdwards 2014-06-16 15:00:57 -07:00
parent c5593491e0
commit 2934514909
5 changed files with 26 additions and 23 deletions

View File

@ -20,8 +20,8 @@ namespace MusicStore.Apis
public async Task<ActionResult> Paged(int page = 1, int pageSize = 50, string sortBy = null)
{
var pagedAlbums = await _storeContext.Albums
.Include(a => a.Genre)
.Include(a => a.Artist)
//.Include(a => a.Genre)
//.Include(a => a.Artist)
.SortBy(sortBy, a => a.Title)
.ToPagedListAsync(page, pageSize);
@ -37,8 +37,8 @@ namespace MusicStore.Apis
return new SmartJsonResult
{
Data = await _storeContext.Albums
.Include(a => a.Genre)
.Include(a => a.Artist)
//.Include(a => a.Genre)
//.Include(a => a.Artist)
.OrderBy(a => a.Title)
.ToListAsync()
};
@ -67,8 +67,8 @@ namespace MusicStore.Apis
// TODO: Make async when EF supports SingleOrDefaultAsync
var album = _storeContext.Albums
.Include(a => a.Artist)
.Include(a => a.Genre)
//.Include(a => a.Artist)
//.Include(a => a.Genre)
.SingleOrDefault(a => a.AlbumId == albumId);
// TODO: Add null checking and return 404 in that case

View File

@ -45,7 +45,7 @@ namespace MusicStore.Apis
return new SmartJsonResult
{
Data = await _storeContext.Genres
.Include(g => g.Albums)
//.Include(g => g.Albums)
.OrderBy(g => g.Name)
.ToListAsync()
};
@ -56,8 +56,8 @@ namespace MusicStore.Apis
{
var albums = await _storeContext.Albums
.Where(a => a.GenreId == genreId)
.Include(a => a.Genre)
.Include(a => a.Artist)
//.Include(a => a.Genre)
//.Include(a => a.Artist)
//.OrderBy(a => a.Genre.Name)
.ToListAsync();

View File

@ -799,6 +799,7 @@
<Content Include="node_modules\grunt\node_modules\lodash\lodash.min.js" />
<Content Include="node_modules\grunt\node_modules\lodash\lodash.underscore.js" />
<Content Include="node_modules\grunt\node_modules\lodash\lodash.underscore.min.js" />
<Content Include="node_modules\grunt\node_modules\nopt\.npmignore" />
<Content Include="node_modules\grunt\node_modules\rimraf\AUTHORS" />
<Content Include="node_modules\grunt\node_modules\underscore.string\Gemfile.lock" />
<Content Include="node_modules\grunt\node_modules\underscore.string\Rakefile" />

View File

@ -1,9 +1,14 @@
{
"compilationOptions" : { "define" : ["DEBUG"] },
"authors": [
"Microsoft"
],
"description": "Music store application on K as a SPA",
"compilationOptions": { "define": [ "DEBUG" ] },
"dependencies": {
"Helios" : "0.1-alpha-*",
"Microsoft.AspNet.Mvc" : "0.1-alpha-*",
"Microsoft.AspNet.StaticFiles" : "0.1-alpha-*",
"Helios": "0.1-alpha-*",
"Microsoft.AspNet.Mvc": "0.1-alpha-*",
"Microsoft.AspNet.Server.WebListener": "0.1-alpha-*",
"Microsoft.AspNet.StaticFiles": "0.1-alpha-*",
"Microsoft.Data.Entity.Relational": "0.1-alpha-*",
"Microsoft.Data.Entity.InMemory": "0.1-alpha-*",
"Microsoft.Data.Entity.SqlServer": "0.1-alpha-*",
@ -13,14 +18,12 @@
"Microsoft.Framework.ConfigurationModel": "0.1-alpha-*",
"Microsoft.Framework.ConfigurationModel.Json": "0.1-alpha-build-*"
},
"configurations" : {
"net451" : {
"dependencies": {
"System.Runtime" : "",
"System.Data": "",
"System.ComponentModel.DataAnnotations": ""
}
},
"k10" : { }
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5002",
"run": "run server.urls=http://localhost:5003"
},
"configurations": {
"net451": { },
"k10": { }
}
}

View File

@ -3,7 +3,6 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.FileSystems;
using Microsoft.AspNet.Http;
using Microsoft.AspNet.Identity;
using Microsoft.AspNet.Identity.Security;
using Microsoft.AspNet.Mvc.Rendering;
using Microsoft.AspNet.Routing;
using Microsoft.AspNet.Security.Cookies;