Skip to content
This repository has been archived by the owner on Feb 13, 2019. It is now read-only.

⬆️ Update web application template to aspnet. Closes #694 #702

Merged
merged 3 commits into from
May 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace <%= namespace %>.Data.Migrations
Expand Down Expand Up @@ -69,7 +66,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("Autoincrement", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
RoleId = table.Column<string>(nullable: false)
Expand All @@ -90,7 +87,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
columns: table => new
{
Id = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
.Annotation("Autoincrement", true),
ClaimType = table.Column<string>(nullable: true),
ClaimValue = table.Column<string>(nullable: true),
UserId = table.Column<string>(nullable: false)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using <%= namespace %>.Data;

namespace <%= namespace %>.Data.Migrations
{
Expand All @@ -14,8 +13,7 @@ partial class ApplicationDbContextModelSnapshot : ModelSnapshot
protected override void BuildModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasAnnotation("ProductVersion", "1.0.0-rc2")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasAnnotation("ProductVersion", "1.0.0-rc2-20901");

modelBuilder.Entity("Microsoft.AspNetCore.Identity.EntityFrameworkCore.IdentityRole", b =>
{
Expand Down
15 changes: 15 additions & 0 deletions templates/projects/web/Properties/launchSettings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:55385/",
"sslPort": 0
}
},
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
},
"<%= namespace %>": {
"commandName": "Project",
"launchBrowser": true,
Expand Down
11 changes: 3 additions & 8 deletions templates/projects/web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,7 @@ public Startup(IHostingEnvironment env)
{
var builder = new ConfigurationBuilder()
.SetBasePath(env.ContentRootPath)
.AddJsonFile(source =>
{
source.Path = "appsettings.json";
source.ReloadOnChange = true;
})
.AddJsonFile("appsettings.json", optional: true, reloadOnChange: true)
.AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true);

if (env.IsDevelopment())
Expand All @@ -36,7 +32,6 @@ public Startup(IHostingEnvironment env)

builder.AddEnvironmentVariables();
Configuration = builder.Build();
Configuration["ConnectionStrings:SQLite"] = $"Data Source={env.ContentRootPath}/<%= namespace %>.db";
}

public IConfigurationRoot Configuration { get; }
Expand All @@ -46,7 +41,7 @@ public void ConfigureServices(IServiceCollection services)
{
// Add framework services.
services.AddDbContext<ApplicationDbContext>(options =>
options.UseSqlite(Configuration.GetConnectionString("SQLite")));
options.UseSqlite(Configuration.GetConnectionString("DefaultConnection")));

services.AddIdentity<ApplicationUser, IdentityRole>()
.AddEntityFrameworkStores<ApplicationDbContext>()
Expand Down Expand Up @@ -80,7 +75,7 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerF

app.UseIdentity();

// To configure external authentication please see https://go.microsoft.com/fwlink/?LinkID=532715
// Add external authentication middleware below. To configure them please see https://go.microsoft.com/fwlink/?LinkID=532715

app.UseMvc(routes =>
{
Expand Down
3 changes: 3 additions & 0 deletions templates/projects/web/appsettings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
{
"ConnectionStrings": {
"DefaultConnection": "Data Source=<%= namespace %>.db"
},
"Logging": {
"IncludeScopes": false,
"LogLevel": {
Expand Down
94 changes: 47 additions & 47 deletions templates/projects/web/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,65 +3,69 @@

"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.0-rc2-24008",
"version": "1.0.0-rc2-3002702",
"type": "platform"
},
"dotnet-aspnet-codegenerator": {
"version": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"dotnet-ef": {
"version": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-final",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-final",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-final",
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"dotnet-razor-tooling": {
"version": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-final",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-final",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-final",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-final",
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"type": "build"
},
"Microsoft.AspNetCore.Authentication.Cookies": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Diagnostics": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Identity.EntityFrameworkCore": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Mvc": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.StaticFiles": "1.0.0-rc2-20581",
"Microsoft.EntityFrameworkCore.Commands": "1.0.0-rc2-20581",
"Microsoft.EntityFrameworkCore.Sqlite": "1.0.0-rc2-20581",
"Microsoft.EntityFrameworkCore.SqlServer": "1.0.0-rc2-20581",
"Microsoft.Extensions.CodeGenerators.Mvc": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.EnvironmentVariables": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.Json": "1.0.0-rc2-20581",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging.Console": "1.0.0-rc2-20581",
"Microsoft.Extensions.Logging.Debug": "1.0.0-rc2-20581",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-rc2-20581"
"Microsoft.VisualStudio.Web.CodeGenerators.Mvc": {
"version": "1.0.0-preview1-final",
"type": "build"
}
},

"tools": {
"dotnet-aspnet-codegenerator": {
"version": "1.0.0-rc2-20581",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"dotnet-ef": {
"version": "1.0.0-rc2-20581",
"imports": "portable-net45+win8+dnxcore50"
},
"dotnet-razor-tooling": {
"version": "1.0.0-rc2-20581",
"Microsoft.AspNetCore.Razor.Tools": {
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
"version": "1.0.0-rc2-20581",
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.EntityFrameworkCore.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
},
"Microsoft.Extensions.SecretManager.Tools": {
"version": "1.0.0-rc2-20581",
"version": "1.0.0-preview1-final",
"imports": "portable-net45+win8+dnxcore50"
},
"Microsoft.VisualStudio.Web.CodeGeneration.Tools": {
"version": "1.0.0-preview1-final",
"imports": [
"portable-net45+win8+dnxcore50",
"portable-net45+win8"
]
}
},

Expand All @@ -75,7 +79,7 @@
}
},

"compilationOptions": {
"buildOptions": {
"emitEntryPoint": true,
"preserveCompilationContext": true
},
Expand All @@ -90,16 +94,12 @@
"Views",
"appsettings.json",
"web.config"
],

"exclude": [
"node_modules"
]
},

"scripts": {
"prepublish": [ "npm install", "bower install"<% if(!grunt){ %>, "gulp clean", "gulp min"<% } %> ],
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath%" ]
"postpublish": [ "dotnet publish-iis --publish-folder %publish:OutputPath% --framework %publish:FullTargetFramework%" ]
},

"tooling": {
Expand Down
Loading