Update MVC with EF article to beta5

pull/351/head
Rick Anderson 2015-06-25 21:45:00 -07:00 committed by danroth27
parent 24c2f2ea6f
commit a1386b9444
34 changed files with 560 additions and 312 deletions

View File

@ -1,13 +1,13 @@
Get Started with Entity Framework 7 Code using ASP.NET MVC 6
============================================================
By `Mike Wasson`_
By `Mike Wasson`_ and `Rick Anderson`_
In this tutorial, youll create a simple web app using ASP.NET MVC and Entity Framework (EF). The app stores records in a SQL database and supports the basic CRUD operations (create, read, update, delete).
.. note:: This tutorial uses Visual Studio 2015. If you are completely new to ASP.NET MVC or Visual Studio, read :doc:`../getting-started/first-mvc-app` first.
The sample app that you'll build manages a list of authors and books. Here is a screenshot of the app:
The sample app that you'll build manages a list of authors and books. Here is a screen shot of the app:
.. image:: mvc-with-entity-framework/_static/screenshot1.png
@ -62,7 +62,7 @@ with this:
:lines: 37-38
:dedent: 24
This adds links to a Books page, which we havent created yet. (That will come later in tutorial.)
This adds a link to the Books page, which we havent created yet. (That will come later in tutorial.)
Add Entity Framework
--------------------
@ -73,7 +73,7 @@ Open the *project.json* file. In the dependencies section, add the following lin
"dependencies": {
...
"EntityFramework.SqlServer": "7.0.0-beta4"
"EntityFramework.SqlServer": "7.0.0-beta5"
},
When you save *project.json*, Visual Studio automatically resolves the new package reference.
@ -92,7 +92,7 @@ We'll define a class for each. First, add a new folder to the project. In Soluti
.. image:: mvc-with-entity-framework/_static/add-folder.png
.. note:: You can put model classes anywhere in your project. The "Models" folder is just a convention.
.. note:: You can put model classes anywhere in your project. The *Models* folder is just a convention.
Right-click the *Models* folder and select **Add** > **New Item**. In the **Add New Item** dialog, select the **Class** template. In the **Name** edit box, type "Author.cs" and click OK. Replace the boilerplate code with:
@ -147,34 +147,36 @@ Add the following code at the end of the *Configure* method:
.. literalinclude:: mvc-with-entity-framework/sample/src/ContosoBooks/Startup.cs
:language: c#
:lines: 71
:lines: 74
:dedent: 12
Notice in *ConfigureServices* that we call ``Configuration.Get`` to get the database connection string. During development, this setting comes from config.json. When you deploy the app to a production environment, you would store the connection string in an environment variable on the host. If the Configuration API finds an environment variable with the same key, it returns the environment variable instead of the value that is in config.json.
Notice in *ConfigureServices* that we call ``Configuration.Get`` to get the database connection string. During development, this setting comes from the *config.json* file. When you deploy the app to a production environment, you set the connection string in an environment variable on the host. If the Configuration API finds an environment variable with the same key, it returns the environment variable instead of the value that is in *config.json*.
Here is the complete *Startup.cs* after these changes:
.. literalinclude:: mvc-with-entity-framework/sample/src/ContosoBooks/Startup.cs
:language: c#
:emphasize-lines: 1,5,32-37,71
:emphasize-lines: 1,5,32-37,74
Use data migrations to create the database
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Open *project.json*. In the "commands" section, add an entry for ``EntityFramework.Commands``:
Open *project.json*.
- In the "commands" and "dependencies" sections, add an entry for ``EntityFramework.Commands``.
.. literalinclude:: mvc-with-entity-framework/sample/src/ContosoBooks/project.json
:language: json
:lines: 21-25
:dedent: 4
:emphasize-lines: 4
:emphasize-lines: 18,23
Open a command prompt in the project directory (/ContosoBooks/src/ContosoBooks) and run the following commands:
Build the app.
.. dnu restore removed
Open a command prompt in the project directory (ContosoBooks/src/ContosoBooks) and run the following commands:
.. code-block:: none
dnvm use default
dnu restore
dnvm use 1.0.0-beta5
dnx . ef migration add Initial
dnx . ef migration apply
@ -182,7 +184,13 @@ The "``add Initial``" command adds code to the project that allows EF to update
.. image:: mvc-with-entity-framework/_static/migrations.png
For more information about ``dnvm``, ``dnu``, and ``dnx``, see :ref:`DNX Overview <aspnet:dnx-overview>`.
- **dnvm** : The .NET Version Manager, a set of command line utilities that are used to update and configure .NET Runtime. The command ``dnvm use 1.0.0-beta5`` instructs the .NET Version Manager to add the 1.0.0-beta5 ASP.NET 5 runtime to the ``PATH`` environment variable for the current shell. For ASP.NET 5 Beta 5, the following is displayed:
.. code-block:: none
Adding C:\\Users\\<user>\\.dnx\\runtimes\\dnx-clr-win-x86.1.0.0-beta5\\bin to process PATH
- **dnx . ef migration add Initial** : `DNX <http://docs.asp.net/en/latest/dnx/overview.html>`_ is the .NET Execution Environment. The ``ef migration apply`` command runs pending migration code. For more information about ``dnvm``, ``dnu``, and ``dnx``, see :ref:`DNX Overview <aspnet:dnx-overview>`.
Add an index page
-----------------
@ -197,7 +205,7 @@ Replace the boilerplate code with the following:
.. literalinclude:: mvc-with-entity-framework/sample/src/ContosoBooks/Controllers/BookController.cs
:language: c#
:lines: 1-26,149-150
:lines: 1-26,161-162
Notice that we don't set any value for ``Logger`` and ``BookContext``. The dependency injection (DI) subsystem automatically sets these properties at runtime. DI also handles the object lifetimes, so you don't need to call ``Dispose``. For more information, see :ref:`Dependency Injection <aspnet:dependency-injection>`.
@ -227,7 +235,7 @@ Add the following method to the ``BooksController`` class:
This code looks up a book by ID. In the EF query:
- The ``Include`` method tells EF to fetch the related ``Author`` entity.
- The ``SingleOrDefault`` method returns a single entity, or ``null`` if none is found.
- The ``SingleOrDefaultAsync`` method returns a single entity, or ``null`` if one is not found.
If the EF query returns ``null``, the controller method returns ``HttpNotFound``, which ASP.NET translates into a 404 response. Otherwise, the controller passes *book* to a view, which renders the details page. Lets add the view now.

View File

@ -1,16 +1,16 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.22823.1
VisualStudioVersion = 14.0.23019.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{AD710406-FC30-4A6B-96BC-AD981A8861D7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{17564FAC-B6C3-4EB4-AF0B-FE8F00B527BA}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{F778A387-EA47-489D-95B5-BC339F4801C7}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{9211E070-3BC1-4F10-9F21-7C5141550F42}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
EndProjectSection
EndProject
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ContosoBooks", "src\ContosoBooks\ContosoBooks.xproj", "{573CDF65-E3B0-4BE5-AEEC-87A50C768B75}"
Project("{8BB2217D-0F2D-49D1-97BC-3654ED321F3B}") = "ContosoBooks", "src\ContosoBooks\ContosoBooks.xproj", "{03F588A7-3C46-492C-8E44-5A45D6F34C46}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@ -18,15 +18,15 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{573CDF65-E3B0-4BE5-AEEC-87A50C768B75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{573CDF65-E3B0-4BE5-AEEC-87A50C768B75}.Debug|Any CPU.Build.0 = Debug|Any CPU
{573CDF65-E3B0-4BE5-AEEC-87A50C768B75}.Release|Any CPU.ActiveCfg = Release|Any CPU
{573CDF65-E3B0-4BE5-AEEC-87A50C768B75}.Release|Any CPU.Build.0 = Release|Any CPU
{03F588A7-3C46-492C-8E44-5A45D6F34C46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{03F588A7-3C46-492C-8E44-5A45D6F34C46}.Debug|Any CPU.Build.0 = Debug|Any CPU
{03F588A7-3C46-492C-8E44-5A45D6F34C46}.Release|Any CPU.ActiveCfg = Release|Any CPU
{03F588A7-3C46-492C-8E44-5A45D6F34C46}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{573CDF65-E3B0-4BE5-AEEC-87A50C768B75} = {AD710406-FC30-4A6B-96BC-AD981A8861D7}
{03F588A7-3C46-492C-8E44-5A45D6F34C46} = {17564FAC-B6C3-4EB4-AF0B-FE8F00B527BA}
EndGlobalSection
EndGlobal

View File

@ -1,6 +1,8 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta4"
}
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-beta5",
"runtime": "clr",
"architecture": "x86"
}
}

View File

@ -0,0 +1,3 @@
{
"directory": "wwwroot/lib"
}

View File

@ -1,20 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
namespace ContosoBooks.Compiler.Preprocess
{
// Uncomment the following class to enable pre-compilation of Razor views.
// Pre-compilation may reduce the time it takes to build and launch your project.
// Please note, in this pre-release of Visual Studio 2015, enabling pre-compilation may cause IntelliSense and build errors in views using Tag Helpers.
//public class RazorPreCompilation : RazorPreCompileModule
//{
// public RazorPreCompilation(IServiceProvider provider) : base(provider)
// {
// GenerateSymbols = true;
// }
//}
}

View File

@ -6,14 +6,14 @@
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.Props" Condition="'$(VSToolsPath)' != ''" />
<PropertyGroup Label="Globals">
<ProjectGuid>573cdf65-e3b0-4be5-aeec-87a50c768b75</ProjectGuid>
<ProjectGuid>03f588a7-3c46-492c-8e44-5a45d6f34c46</ProjectGuid>
<RootNamespace>ContosoBooks</RootNamespace>
<BaseIntermediateOutputPath Condition="'$(BaseIntermediateOutputPath)'=='' ">..\..\artifacts\obj\$(MSBuildProjectName)</BaseIntermediateOutputPath>
<OutputPath Condition="'$(OutputPath)'=='' ">..\..\artifacts\bin\$(MSBuildProjectName)\</OutputPath>
</PropertyGroup>
<PropertyGroup>
<SchemaVersion>2.0</SchemaVersion>
<DevelopmentServerPort>18289</DevelopmentServerPort>
<DevelopmentServerPort>8816</DevelopmentServerPort>
</PropertyGroup>
<Import Project="$(VSToolsPath)\DNX\Microsoft.DNX.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

View File

@ -21,8 +21,8 @@ namespace ContosoBooks.Controllers
public IActionResult Index()
{
var books = BookContext.Books.Include(b => b.Author);
return View(books);
var books = BookContext.Books.Include(b => b.Author);
return View(books);
}
public async Task<ActionResult> Details(int id)
@ -40,7 +40,7 @@ namespace ContosoBooks.Controllers
public ActionResult Create()
{
ViewBag.Items = GetAuthorsListItems();
ViewBag.Items = GetAuthorsListItems();
return View();
}
@ -146,5 +146,17 @@ namespace ContosoBooks.Controllers
Selected = author.AuthorID == selected
});
}
private IEnumerable<SelectListItem> GetAuthorsListItems2246(int selected = -1)
{
return BookContext.Authors
.OrderBy(author => author.LastName)
.Select(author => new SelectListItem
{
Text = String.Format("{0}, {1}", author.LastName, author.FirstMidName),
Value = author.AuthorID.ToString(),
Selected = author.AuthorID == selected
});
}
}
}
}

View File

@ -1,4 +1,8 @@
using Microsoft.AspNet.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNet.Mvc;
namespace ContosoBooks.Controllers
{
@ -11,14 +15,14 @@ namespace ContosoBooks.Controllers
public IActionResult About()
{
ViewBag.Message = "Your application description page.";
ViewData["Message"] = "Your application description page.";
return View();
}
public IActionResult Contact()
{
ViewBag.Message = "Your contact page.";
ViewData["Message"] = "Your contact page.";
return View();
}

View File

@ -1,71 +0,0 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Metadata.Builders;
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
using ContosoBooks.Models;
namespace ContosoBooks.Migrations
{
[ContextType(typeof(BookContext))]
partial class initial
{
public override string Id
{
get { return "20150521200520_initial"; }
}
public override string ProductVersion
{
get { return "7.0.0-beta4-12943"; }
}
public override IModel Target
{
get
{
var builder = new BasicModelBuilder()
.Annotation("SqlServer:ValueGeneration", "Sequence");
builder.Entity("ContosoBooks.Models.Author", b =>
{
b.Property<int>("AuthorID")
.GenerateValueOnAdd()
.Annotation("OriginalValueIndex", 0)
.Annotation("SqlServer:ValueGeneration", "Default");
b.Property<string>("FirstMidName")
.Annotation("OriginalValueIndex", 1);
b.Property<string>("LastName")
.Annotation("OriginalValueIndex", 2);
b.Key("AuthorID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Property<int>("AuthorID")
.Annotation("OriginalValueIndex", 0);
b.Property<int>("BookID")
.GenerateValueOnAdd()
.Annotation("OriginalValueIndex", 1)
.Annotation("SqlServer:ValueGeneration", "Default");
b.Property<string>("Genre")
.Annotation("OriginalValueIndex", 2);
b.Property<decimal>("Price")
.Annotation("OriginalValueIndex", 3);
b.Property<string>("Title")
.Annotation("OriginalValueIndex", 4);
b.Property<int>("Year")
.Annotation("OriginalValueIndex", 5);
b.Key("BookID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.ForeignKey("ContosoBooks.Models.Author", "AuthorID");
});
return builder.Model;
}
}
}
}

View File

@ -0,0 +1,69 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
using ContosoBooks.Models;
namespace ContosoBooks.Migrations
{
[ContextType(typeof(BookContext))]
partial class Initial
{
public override string Id
{
get { return "20150624041210_Initial"; }
}
public override string ProductVersion
{
get { return "7.0.0-beta5-13518"; }
}
public override void BuildTargetModel(ModelBuilder builder)
{
builder
.Annotation("SqlServer:DefaultSequenceName", "DefaultSequence")
.Annotation("SqlServer:Sequence:.DefaultSequence", "'DefaultSequence', '', '1', '10', '', '', 'Int64', 'False'")
.Annotation("SqlServer:ValueGeneration", "Sequence");
builder.Entity("ContosoBooks.Models.Author", b =>
{
b.Property<int>("AuthorID")
.GenerateValueOnAdd()
.StoreGeneratedPattern(StoreGeneratedPattern.Identity);
b.Property<string>("FirstMidName");
b.Property<string>("LastName");
b.Key("AuthorID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Property<int>("BookID")
.GenerateValueOnAdd()
.StoreGeneratedPattern(StoreGeneratedPattern.Identity);
b.Property<int>("AuthorID");
b.Property<string>("Genre");
b.Property<decimal>("Price");
b.Property<string>("Title");
b.Property<int>("Year");
b.Key("BookID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Reference("ContosoBooks.Models.Author")
.InverseCollection()
.ForeignKey("AuthorID");
});
}
}
}

View File

@ -5,7 +5,7 @@ using Microsoft.Data.Entity.Relational.Migrations.Operations;
namespace ContosoBooks.Migrations
{
public partial class initial : Migration
public partial class Initial : Migration
{
public override void Up(MigrationBuilder migration)
{
@ -30,8 +30,8 @@ namespace ContosoBooks.Migrations
name: "Book",
columns: table => new
{
AuthorID = table.Column(type: "int", nullable: false),
BookID = table.Column(type: "int", nullable: false),
AuthorID = table.Column(type: "int", nullable: false),
Genre = table.Column(type: "nvarchar(max)", nullable: true),
Price = table.Column(type: "decimal(18, 2)", nullable: false),
Title = table.Column(type: "nvarchar(max)", nullable: true),

View File

@ -1,7 +1,6 @@
using System;
using Microsoft.Data.Entity;
using Microsoft.Data.Entity.Metadata;
using Microsoft.Data.Entity.Metadata.Builders;
using Microsoft.Data.Entity.Relational.Migrations.Infrastructure;
using ContosoBooks.Models;
@ -10,52 +9,51 @@ namespace ContosoBooks.Migrations
[ContextType(typeof(BookContext))]
partial class BookContextModelSnapshot : ModelSnapshot
{
public override IModel Model
public override void BuildModel(ModelBuilder builder)
{
get
{
var builder = new BasicModelBuilder()
.Annotation("SqlServer:ValueGeneration", "Sequence");
builder.Entity("ContosoBooks.Models.Author", b =>
{
b.Property<int>("AuthorID")
.GenerateValueOnAdd()
.Annotation("OriginalValueIndex", 0)
.Annotation("SqlServer:ValueGeneration", "Default");
b.Property<string>("FirstMidName")
.Annotation("OriginalValueIndex", 1);
b.Property<string>("LastName")
.Annotation("OriginalValueIndex", 2);
b.Key("AuthorID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Property<int>("AuthorID")
.Annotation("OriginalValueIndex", 0);
b.Property<int>("BookID")
.GenerateValueOnAdd()
.Annotation("OriginalValueIndex", 1)
.Annotation("SqlServer:ValueGeneration", "Default");
b.Property<string>("Genre")
.Annotation("OriginalValueIndex", 2);
b.Property<decimal>("Price")
.Annotation("OriginalValueIndex", 3);
b.Property<string>("Title")
.Annotation("OriginalValueIndex", 4);
b.Property<int>("Year")
.Annotation("OriginalValueIndex", 5);
b.Key("BookID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.ForeignKey("ContosoBooks.Models.Author", "AuthorID");
});
return builder.Model;
}
builder
.Annotation("SqlServer:DefaultSequenceName", "DefaultSequence")
.Annotation("SqlServer:Sequence:.DefaultSequence", "'DefaultSequence', '', '1', '10', '', '', 'Int64', 'False'")
.Annotation("SqlServer:ValueGeneration", "Sequence");
builder.Entity("ContosoBooks.Models.Author", b =>
{
b.Property<int>("AuthorID")
.GenerateValueOnAdd()
.StoreGeneratedPattern(StoreGeneratedPattern.Identity);
b.Property<string>("FirstMidName");
b.Property<string>("LastName");
b.Key("AuthorID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Property<int>("BookID")
.GenerateValueOnAdd()
.StoreGeneratedPattern(StoreGeneratedPattern.Identity);
b.Property<int>("AuthorID");
b.Property<string>("Genre");
b.Property<decimal>("Price");
b.Property<string>("Title");
b.Property<int>("Year");
b.Key("BookID");
});
builder.Entity("ContosoBooks.Models.Book", b =>
{
b.Reference("ContosoBooks.Models.Author")
.InverseCollection()
.ForeignKey("AuthorID");
});
}
}
}

View File

@ -7,4 +7,4 @@ namespace ContosoBooks.Models
public DbSet<Author> Authors { get; set; }
public DbSet<Book> Books { get; set; }
}
}
}

View File

@ -22,22 +22,42 @@ namespace ContosoBooks.Models
new Author { LastName = "Cervantes", FirstMidName = "Miguel" }).Entity;
context.Books.AddRange(
new Book() {
Title = "Pride and Prejudice", Year = 1813, Author = austen,
Price = 9.99M, Genre = "Comedy of manners" },
new Book() {
Title = "Northanger Abbey", Year = 1817, Author = austen,
Price = 12.95M, Genre = "Gothic parody" },
new Book() {
Title = "David Copperfield", Year = 1850, Author = dickens,
Price = 15, Genre = "Bildungsroman" },
new Book() {
Title = "Don Quixote", Year = 1617, Author = cervantes,
Price = 8.95M, Genre = "Picaresque" }
new Book()
{
Title = "Pride and Prejudice",
Year = 1813,
Author = austen,
Price = 9.99M,
Genre = "Comedy of manners"
},
new Book()
{
Title = "Northanger Abbey",
Year = 1817,
Author = austen,
Price = 12.95M,
Genre = "Gothic parody"
},
new Book()
{
Title = "David Copperfield",
Year = 1850,
Author = dickens,
Price = 15,
Genre = "Bildungsroman"
},
new Book()
{
Title = "Don Quixote",
Year = 1617,
Author = cervantes,
Price = 8.95M,
Genre = "Picaresque"
}
);
context.SaveChanges();
}
}
}
}
}
}

View File

@ -0,0 +1,203 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Welcome to ASP.NET 5</title>
<style>
html {
background: #f1f1f1;
height: 100%;
}
body {
background: #fff;
color: #505050;
font: 14px 'Segoe UI', tahoma, arial, helvetica, sans-serif;
margin: 1%;
min-height: 95.5%;
border: 1px solid silver;
position: relative;
}
#header {
padding: 0;
}
#header h1 {
font-size: 44px;
font-weight: normal;
margin: 0;
padding: 10px 30px 10px 30px;
}
#header span {
margin: 0;
padding: 0 30px;
display: block;
}
#header p {
font-size: 20px;
color: #fff;
background: #007acc;
padding: 0 30px;
line-height: 50px;
margin-top: 25px;
}
#header p a {
color: #fff;
text-decoration: underline;
font-weight: bold;
padding-right: 35px;
background: no-repeat right bottom url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABcAAAAWCAMAAAAcqPc3AAAANlBMVEUAAAAAeswfitI9mthXp91us+KCvuaTx+mjz+2x1u+83PLH4vTR5/ba7Pjj8Pns9fv1+v3////wy3dWAAAAAXRSTlMAQObYZgAAAHxJREFUeNp9kVcSwCAIRMHUYoH7XzaxOxJ9P8oyQ1uIqNPwh3s2aLmIM2YtqrLcQIeQEylhuCeUOlhgve5yoBCfWmlnlgkN4H8ykbpaE7gR03AbUHiwoOxUH9Xp+ubd41p1HF3mBPrfC87BHeTdaB3ceeKL9HGpcvX9zu6+DdMWT9KQPvYAAAAASUVORK5CYII=);
}
#main {
padding: 5px 30px;
clear: both;
}
.section {
width: 21.7%;
float: left;
margin: 0 0 0 4%;
}
.section h2 {
font-size: 13px;
text-transform: uppercase;
margin: 0;
border-bottom: 1px solid silver;
padding-bottom: 12px;
margin-bottom: 8px;
}
.section.first {
margin-left: 0;
}
.section.first h2 {
font-size: 24px;
text-transform: none;
margin-bottom: 25px;
border: none;
}
.section.first li {
border-top: 1px solid silver;
padding: 8px 0;
}
.section.last {
margin-right: 0;
}
ul {
list-style: none;
padding: 0;
margin: 0;
line-height: 20px;
}
li {
padding: 4px 0;
}
a {
color: #267cb2;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
#footer {
clear: both;
padding-top: 50px;
}
#footer p {
position: absolute;
bottom: 10px;
}
</style>
</head>
<body>
<div id="header">
<h1>Welcome to ASP.NET 5 Preview</h1>
<span>
We've made some big updates in this release, so its <b>important</b> that you spend
a few minutes to learn whats new.
<br /><br />
ASP.NET 5 has been rearchitected to make it <b>lean</b> and <b>composable</b>. It's fully
<b>open source</b> and available on <a href="http://go.microsoft.com/fwlink/?LinkID=517854">GitHub</a>.
<br />
Your new project automatically takes advantage of modern client-side utilities
like <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518005">npm</a>
(to add client-side libraries) and <a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> (for client-side build and automation tasks).
<br /><br />
We hope you enjoy the new capabilities in ASP.NET 5 and Visual Studio 2015.
<br />
The ASP.NET Team
</span>
<p>You've created a new ASP.NET 5 project. <a href="http://go.microsoft.com/fwlink/?LinkId=518016">Learn what's new</a></p>
</div>
<div id="main">
<div class="section first">
<h2>This application consists of:</h2>
<ul>
<li>Sample pages using ASP.NET MVC 6</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side resources</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="section">
<h2>New concepts</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">The 'wwwroot' explained</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518012">Configuration in ASP.NET 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518013">Dependency Injection</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518014">Razor TagHelpers</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517849">Manage client tasks using Gulp</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517850">Develop on different platforms</a></li>
</ul>
</div>
<div class="section">
<h2>Customize app</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add Controllers and Views</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398602">Add Data using EntityFramework</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398603">Add Authentication using Identity</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398606">Add real time support using SignalR</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398604">Add Class library</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518009">Add Web APIs with MVC 6</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517848">Add client packages using Bower</a></li>
</ul>
</div>
<div class="section last">
<h2>Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app locally</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on ASP.NET Core 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your project.json</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Sites</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518019">Publish to the file system</a></li>
</ul>
</div>
<div id="footer">
<p>We would love to hear your <a href="http://go.microsoft.com/fwlink/?LinkId=518015">feedback</a></p>
</div>
</div>
</body>
</html>

View File

@ -1,12 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace ContosoBooks
{
public class AppSettings
{
public string SiteTitle { get; set; }
}
}

View File

@ -3,20 +3,22 @@ using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Diagnostics;
using Microsoft.AspNet.Hosting;
using Microsoft.Data.Entity;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.Configuration;
using Microsoft.Framework.DependencyInjection;
using Microsoft.Framework.Logging;
using Microsoft.Framework.Runtime;
namespace ContosoBooks
{
public class Startup
{
public Startup(IHostingEnvironment env)
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv)
{
// Setup configuration sources.
Configuration = new Configuration()
var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath)
.AddJsonFile("config.json")
.AddEnvironmentVariables();
Configuration = builder.Build();
}
public IConfiguration Configuration { get; set; }
@ -24,8 +26,6 @@ namespace ContosoBooks
// This method gets called by the runtime.
public void ConfigureServices(IServiceCollection services)
{
services.Configure<AppSettings>(Configuration.GetSubKey("AppSettings"));
// Add MVC services to the services container.
services.AddMvc();
@ -38,15 +38,15 @@ namespace ContosoBooks
}
// Configure is called after ConfigureServices is called.
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerfactory)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
loggerFactory.MinimumLevel = LogLevel.Information;
loggerFactory.AddConsole();
// Configure the HTTP request pipeline.
// Add the console logger.
loggerfactory.AddConsole(minLevel: LogLevel.Verbose);
// Add the following to the request pipeline only in development environment.
if (env.IsEnvironment("Development"))
if (env.IsDevelopment())
{
app.UseBrowserLink();
app.UseErrorPage(ErrorPageOptions.ShowAll);
@ -66,7 +66,10 @@ namespace ContosoBooks
{
routes.MapRoute(
name: "default",
template: "{controller=Home}/{action=Index}/{id?}");
template: "{controller=Book}/{action=Index}/{id?}");
// Uncomment the following line to add a route for porting Web API 2 controllers.
// routes.MapWebApiRoute("DefaultApi", "api/{controller}/{id?}");
});
SampleData.Initialize(app.ApplicationServices);
}

View File

@ -1,6 +1,6 @@
@model IEnumerable<ContosoBooks.Models.Book>
@{
ViewBag.Title = "Books";
ViewBag.Title = "Books";
}
<p>
<a asp-action="Create">Create New Book</a>
@ -32,5 +32,4 @@
</td>
</tr>
}
</table>
</table>

View File

@ -1,7 +1,9 @@
@{
ViewBag.Title = "About";
ViewData["Title"] = "About";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<a asp-controller="bogus" asp-action="Register">Test</a>
<p>Use this area to provide additional information.</p>

View File

@ -1,8 +1,8 @@
@{
ViewBag.Title = "Contact";
ViewData["Title"] = "Contact";
}
<h2>@ViewBag.Title.</h2>
<h3>@ViewBag.Message</h3>
<h2>@ViewData["Title"].</h2>
<h3>@ViewData["Message"]</h3>
<address>
One Microsoft Way<br />
@ -12,6 +12,6 @@
</address>
<address>
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
</address>

View File

@ -1,5 +1,5 @@
@{
ViewBag.Title = "Home Page";
ViewData["Title"] = "Home Page";
}
<div id="myCarousel" class="carousel slide" data-ride="carousel" data-interval="6000">
@ -66,33 +66,39 @@
</div>
<div class="row">
<div class="col-md-4">
<h2>This application consists of:</h2>
<div class="col-md-3">
<h2>Application uses</h2>
<ul>
<li>Sample pages showing basic nav</li>
<li>Sample pages using ASP.NET 5 (MVC 6)</li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518007">Gulp</a> and <a href="http://go.microsoft.com/fwlink/?LinkId=518004">Bower</a> for managing client-side resources</li>
<li>Theming using <a href="http://go.microsoft.com/fwlink/?LinkID=398939">Bootstrap</a></li>
</ul>
</div>
<div class="col-md-4">
<div class="col-md-3">
<h2>New concepts</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Conceptual overview of ASP.NET 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkId=518008">Fundamentals in ASP.NET 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517849">Client-Side Development using npm, Bower and Gulp</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517850">Develop on different platforms</a></li>
</ul>
</div>
<div class="col-md-3">
<h2>Customize app</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398600">Add Controllers and Views</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398602">Add Data using EntityFramework</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398603">Add Authentication using Identity</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398606">Add real time support using SignalR</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398604">Add Class library</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517848">Add client packages using Bower</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517849">Manage client packages using Grunt</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517850">Develop on different platforms</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517848">Manage client-side packages using Bower/ Gulp</a></li>
</ul>
</div>
<div class="col-md-4">
<h2>Run & Deploy</h2>
<div class="col-md-3">
<h2>Deploy</h2>
<ul>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517851">Run your app locally</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on ASP.NET Core 5</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands defined in your project.json</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Sites</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517852">Run your app on .NET Core</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=517853">Run commands in your app</a></li>
<li><a href="http://go.microsoft.com/fwlink/?LinkID=398609">Publish to Microsoft Azure Web Apps</a></li>
</ul>
</div>
</div>

View File

@ -1,5 +1,5 @@
@{
ViewBag.Title = "Error";
ViewData["Title"] = "Error";
}
<h1 class="text-danger">Error.</h1>

View File

@ -1,14 +1,13 @@
@inject IOptions<AppSettings> AppSettings
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@ViewBag.Title - @AppSettings.Options.SiteTitle</title>
<title>@ViewData["Title"] - ContosoBooks</title>
<environment names="Development">
<link rel="stylesheet" href="~/lib/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="~/lib/bootstrap-touch-carousel/css/bootstrap-touch-carousel.css" />
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="~/lib/bootstrap-touch-carousel/dist/css/bootstrap-touch-carousel.css" />
<link rel="stylesheet" href="~/css/site.css" />
</environment>
<environment names="Staging,Production">
@ -18,7 +17,7 @@
<link rel="stylesheet" href="//ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/css/bootstrap-touch-carousel.css"
asp-fallback-href="~/lib/bootstrap-touch-carousel/css/bootstrap-touch-carousel.css"
asp-fallback-test-class="carousel-caption" asp-fallback-test-property="display" asp-fallback-test-value="none" />
<link rel="stylesheet" href="~/css/site.css" />
<link rel="stylesheet" href="~/css/site.css" asp-file-version="true" />
</environment>
</head>
<body>
@ -30,13 +29,14 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a asp-controller="Home" asp-action="Index" class="navbar-brand">@AppSettings.Options.SiteTitle</a>
<a asp-controller="Home" asp-action="Index" class="navbar-brand">ContosoBooks</a>
</div>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a asp-controller="Home" asp-action="Index">Home</a></li>
<li><a asp-controller="Book" asp-action="Index">Books</a></li>
<li><a asp-controller="Author" asp-action="Index">Authors</a></li>
</ul>
</div>
</div>
@ -45,33 +45,34 @@
@RenderBody()
<hr />
<footer>
<p>&copy; 2015 - @AppSettings.Options.SiteTitle</p>
<p>&copy; 2015 - ContosoBooks</p>
</footer>
</div>
<environment names="Development">
<script src="~/lib/jquery/jquery.js"></script>
<script src="~/lib/bootstrap/js/bootstrap.js"></script>
<script src="~/lib/jquery/dist/jquery.js"></script>
<script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
<script src="~/lib/hammer.js/hammer.js"></script>
<script src="~/lib/bootstrap-touch-carousel/js/bootstrap-touch-carousel.js"></script>
<script src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"></script>
</environment>
<environment names="Staging,Production">
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-1.10.2.min.js"
asp-fallback-src="~/lib/jquery/jquery.min.js"
<script src="//ajax.aspnetcdn.com/ajax/jquery/jquery-2.1.4.min.js"
asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
asp-fallback-test="window.jQuery">
</script>
<script src="//ajax.aspnetcdn.com/ajax/bootstrap/3.0.0/bootstrap.min.js"
asp-fallback-src="~/lib/bootstrap/js/bootstrap.min.js"
asp-fallback-test="window.jQuery">
asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal">
</script>
<script src="//ajax.aspnetcdn.com/ajax/hammer.js/2.0.4/hammer.min.js"
asp-fallback-src="~/lib/hammer.js/hammer.js"
asp-fallback-test="window.Hammer">
</script>
<script src="//ajax.aspnetcdn.com/ajax/bootstrap-touch-carousel/0.8.0/js/bootstrap-touch-carousel.js"
asp-fallback-src="~/lib/bootstrap-touch-carousel/js/bootstrap-touch-carousel.js"
asp-fallback-test="window.Zepto">
asp-fallback-src="~/lib/bootstrap-touch-carousel/dist/js/bootstrap-touch-carousel.js"
asp-fallback-test="window.Hammer && window.Hammer.Instance">
</script>
<script src="~/js/site.js" asp-file-version="true"></script>
</environment>
@RenderSection("scripts", required: false)

View File

@ -1,3 +1,2 @@
@using ContosoBooks
@using Microsoft.Framework.OptionsModel
@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"

View File

@ -3,10 +3,10 @@
"private": true,
"dependencies": {
"bootstrap": "3.0.0",
"jquery": "1.10.2",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2",
"bootstrap-touch-carousel": "0.8.0",
"hammer.js": "2.0.4",
"bootstrap-touch-carousel": "0.8.0"
"jquery": "2.1.4",
"jquery-validation": "1.11.1",
"jquery-validation-unobtrusive": "3.2.2"
}
}

View File

@ -5,4 +5,4 @@
"Data": {
"ConnectionString": "Server=(localdb)\\MSSQLLocalDB;Database=ContosoBooks;Trusted_Connection=True;MultipleActiveResultSets=true"
}
}
}

View File

@ -1,32 +1,45 @@
/// <binding Clean='clean' />
var gulp = require("gulp"),
rimraf = require("rimraf"),
fs = require("fs");
eval("var project = " + fs.readFileSync("./project.json"));
rimraf = require("rimraf"),
concat = require("gulp-concat"),
cssmin = require("gulp-cssmin"),
uglify = require("gulp-uglify"),
project = require("./project.json");
var paths = {
bower: "./bower_components/",
lib: "./" + project.webroot + "/lib/"
webroot: "./" + project.webroot + "/"
};
gulp.task("clean", function (cb) {
rimraf(paths.lib, cb);
paths.js = paths.webroot + "js/**/*.js";
paths.minJs = paths.webroot + "js/**/*.min.js";
paths.css = paths.webroot + "css/**/*.css";
paths.minCss = paths.webroot + "css/**/*.min.css";
paths.concatJsDest = paths.webroot + "js/site.min.js";
paths.concatCssDest = paths.webroot + "css/site.min.css";
gulp.task("clean:js", function (cb) {
rimraf(paths.concatJsDest, cb);
});
gulp.task("copy", ["clean"], function () {
var bower = {
"bootstrap": "bootstrap/dist/**/*.{js,map,css,ttf,svg,woff,eot}",
"bootstrap-touch-carousel": "bootstrap-touch-carousel/dist/**/*.{js,css}",
"hammer.js": "hammer.js/hammer*.{js,map}",
"jquery": "jquery/jquery*.{js,map}",
"jquery-validation": "jquery-validation/jquery.validate.js",
"jquery-validation-unobtrusive": "jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"
}
for (var destinationDir in bower) {
gulp.src(paths.bower + bower[destinationDir])
.pipe(gulp.dest(paths.lib + destinationDir));
}
gulp.task("clean:css", function (cb) {
rimraf(paths.concatCssDest, cb);
});
gulp.task("clean", ["clean:js", "clean:css"]);
gulp.task("min:js", function () {
gulp.src([paths.js, "!" + paths.minJs], { base: "." })
.pipe(concat(paths.concatJsDest))
.pipe(uglify())
.pipe(gulp.dest("."));
});
gulp.task("min:css", function () {
gulp.src([paths.css, "!" + paths.minCss])
.pipe(concat(paths.concatCssDest))
.pipe(cssmin())
.pipe(gulp.dest("."));
});
gulp.task("min", ["min:js", "min:css"]);

View File

@ -0,0 +1,2 @@
server=Microsoft.AspNet.Server.WebListener
server.urls=http://localhost:5000

View File

@ -3,6 +3,9 @@
"version": "0.0.0",
"devDependencies": {
"gulp": "3.8.11",
"gulp-concat": "2.5.2",
"gulp-cssmin": "0.1.7",
"gulp-uglify": "1.2.0",
"rimraf": "2.2.8"
}
}

View File

@ -3,26 +3,25 @@
"version": "1.0.0-*",
"dependencies": {
"Microsoft.AspNet.Diagnostics": "1.0.0-beta4",
"Microsoft.AspNet.Mvc": "6.0.0-beta4" ,
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta4",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta4",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta4",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta4",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta4",
"Microsoft.Framework.ConfigurationModel.Json": "1.0.0-beta4",
"Microsoft.Framework.CodeGenerators.Mvc": "1.0.0-beta4",
"Microsoft.Framework.Logging": "1.0.0-beta4",
"Microsoft.Framework.Logging.Console": "1.0.0-beta4",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta4",
"EntityFramework.SqlServer": "7.0.0-beta4"
"Microsoft.AspNet.Diagnostics": "1.0.0-beta5",
"Microsoft.AspNet.Mvc": "6.0.0-beta5",
"Microsoft.AspNet.Mvc.TagHelpers": "6.0.0-beta5",
"Microsoft.AspNet.Server.IIS": "1.0.0-beta5",
"Microsoft.AspNet.Server.WebListener": "1.0.0-beta5",
"Microsoft.AspNet.StaticFiles": "1.0.0-beta5",
"Microsoft.AspNet.Tooling.Razor": "1.0.0-beta5",
"Microsoft.Framework.Configuration.Json": "1.0.0-beta5",
"Microsoft.Framework.Logging": "1.0.0-beta5",
"Microsoft.Framework.Logging.Console": "1.0.0-beta5",
"Microsoft.VisualStudio.Web.BrowserLink.Loader": "14.0.0-beta5",
"EntityFramework.SqlServer": "7.0.0-beta5",
"EntityFramework.Commands": "7.0.0-beta5"
},
"commands": {
"web": "Microsoft.AspNet.Hosting --server Microsoft.AspNet.Server.WebListener --server.urls http://localhost:5000",
"gen": "Microsoft.Framework.CodeGeneration",
"web": "Microsoft.AspNet.Hosting --config hosting.ini",
"ef": "EntityFramework.Commands"
},
},
"frameworks": {
"dnx451": { },
@ -42,7 +41,6 @@
"**.vspscc"
],
"scripts": {
"postrestore": [ "npm install", "bower install" ],
"prepare": [ "gulp copy" ]
"prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]
}
}

View File

@ -1,9 +1,3 @@
/// <autosync enabled="true" />
/// <reference path="../gulpfile.js" />
/// <reference path="lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js" />
/// <reference path="lib/jquery-validation/jquery.validate.js" />
/// <reference path="lib/jquery/jquery.js" />
/// <reference path="lib/jquery/jquery-migrate.js" />
/// <reference path="lib/hammer.js/hammer.js" />
/// <reference path="lib/bootstrap/js/bootstrap.js" />
/// <reference path="lib/bootstrap-touch-carousel/js/bootstrap-touch-carousel.js" />
/// <reference path="js/site.js" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -0,0 +1 @@
// Write your Javascript code.

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<system.webServer>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
<remove name="TRACEVerbHandler" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="*" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" />
</handlers>
</system.webServer>
</configuration>