Add strong naming and fix DB path on IIS Express

This commit is contained in:
SteveSandersonMS
2016-02-02 15:10:15 +00:00
parent 2218212c92
commit 73e218de4e
10 changed files with 20 additions and 27 deletions

View File

@@ -3,3 +3,8 @@
/wwwroot/ng-app/**/*.js
/project.lock.json
/music-db.sqlite
/Properties/launchSettings.json
# Obviously you don't really want your DB to go in wwwroot, but due to https://github.com/aspnet/Microsoft.Data.Sqlite/issues/188
# it currently does when run from IIS Express. Will resolve this once RC2 is out, which is supposed to eliminate the inconsistency.
/wwwroot/music-db.sqlite

View File

@@ -22,36 +22,10 @@ namespace MusicStore.Models
if (await db.Database.EnsureCreatedAsync())
{
await InsertTestData(serviceProvider);
await CreateAdminUser(serviceProvider);
}
}
}
private static async Task CreateAdminUser(IServiceProvider serviceProvider)
{
return;
var settings = serviceProvider.GetService<IOptions<SiteSettings>>().Value;
const string adminRole = "Administrator";
var userManager = serviceProvider.GetService<UserManager<ApplicationUser>>();
var roleManager = serviceProvider.GetService<RoleManager<IdentityRole>>();
if (!await roleManager.RoleExistsAsync(adminRole))
{
await roleManager.CreateAsync(new IdentityRole(adminRole));
}
var user = await userManager.FindByNameAsync(settings.DefaultAdminUsername);
if (user == null)
{
user = new ApplicationUser { UserName = settings.DefaultAdminUsername };
await userManager.CreateAsync(user, settings.DefaultAdminPassword);
await userManager.AddToRoleAsync(user, adminRole);
await userManager.AddClaimAsync(user, new Claim("app-ManageStore", "Allowed"));
}
}
private static async Task InsertTestData(IServiceProvider serviceProvider)
{
var albums = GetAlbums(imgUrl, Genres, Artists);

View File

@@ -1 +1,2 @@
/node_modules/
/Properties/launchSettings.json

View File

@@ -3,3 +3,4 @@ project.lock.json
/wwwroot/bundle.*
/wwwroot/*.svg
/wwwroot/*.css
/Properties/launchSettings.json

View File

@@ -7,7 +7,7 @@ namespace ReactExample.Controllers
public class PeopleApiController : Controller
{
[HttpPut("api/people/{personId:int}")]
public async Task<ActionResult> UpdatePerson([FromBody] PersonDto person)
public ActionResult UpdatePerson([FromBody] PersonDto person)
{
if (!ModelState.IsValid) {
return HttpBadRequest(ModelState);

View File

@@ -1,6 +1,9 @@
{
"version": "1.0.0-alpha7",
"description": "Helpers for building Angular 2 applications on ASP.NET 5.",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
},
"authors": [ "Microsoft" ],
"repository": {
"type": "git",

View File

@@ -1,6 +1,9 @@
{
"version": "1.0.0-alpha7",
"description": "Invoke Node.js modules at runtime in ASP.NET 5 applications.",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
},
"authors": [ "Microsoft" ],
"repository": {
"type": "git",

View File

@@ -1,6 +1,9 @@
{
"version": "1.0.0-alpha7",
"description": "Helpers for building React applications on ASP.NET 5.",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
},
"authors": [ "Microsoft" ],
"repository": {
"type": "git",

View File

@@ -1,6 +1,9 @@
{
"version": "1.0.0-alpha7-1",
"description": "Microsoft.AspNet.SpaServices",
"compilationOptions": {
"keyFile": "../../tools/Key.snk"
},
"authors": [
"Microsoft"
],

BIN
tools/Key.snk Normal file

Binary file not shown.