Skip to content
This repository was archived by the owner on Apr 11, 2021. It is now read-only.
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
4 changes: 2 additions & 2 deletions ASPNET/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Building this sample starts with an empty ASP.NET Core Web project, and adds man

To build and run the .NET Core samples, please install
* Visual Studio 2015 Update 3
* .NET Core 1.0 for Visual Studio
* .NET Core 1.1

Please download and install the tools from [.NET Core downloads](https://www.microsoft.com/net/core#windows).
Please download and install the tools from [.NET Core downloads](https://dot.net).

For code comments and issues please check [Professional C#'s GitHub Repository](https://github.com/ProfessionalCSharp/ProfessionalCSharp6)

Expand Down
2 changes: 1 addition & 1 deletion ASPNET/WebSampleApp/global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "test" ],
"sdk": {
"version": "1.0.0-preview2-003121"
"version": "1.0.0-preview2-1-003177"
}
}
19 changes: 19 additions & 0 deletions ASPNET/WebSampleApp/src/WebSampleApp/Helpers/HtmlHelper.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace WebSampleApp.Helpers
{
public static class HtmlHelper
{
public static string DocType() => "<!DOCTYPE HTML>";

public static string Head() => "<head><meta charset=\"utf-8\"><title>Sample</title></head>";

public static string HtmlStart() => "<html lang=\"en\">";
public static string HtmlEnd() => "</html>";
public static string BodyStart() => "<body>";
public static string BodyEnd() => "</body>";
}
}
5 changes: 5 additions & 0 deletions ASPNET/WebSampleApp/src/WebSampleApp/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using WebSampleApp.Services;
using Microsoft.Extensions.Logging;
using System.Text;
using WebSampleApp.Helpers;

namespace WebSampleApp
{
Expand Down Expand Up @@ -233,7 +234,9 @@ await context.Response.WriteAsync(
result = RequestAndResponseSample.GetRequestInformation(context.Request);
break;
}
await context.Response.WriteAsync(HtmlHelper.DocType() + HtmlHelper.HtmlStart() + HtmlHelper.Head() + HtmlHelper.BodyStart());
await context.Response.WriteAsync(result);
await context.Response.WriteAsync(HtmlHelper.BodyEnd() + HtmlHelper.HtmlEnd());
});
});

Expand All @@ -244,6 +247,7 @@ await context.Response.WriteAsync(
app.Run(async (context) =>
{
var sb = new StringBuilder();
sb.Append(HtmlHelper.DocType() + HtmlHelper.HtmlStart() + HtmlHelper.Head() + HtmlHelper.BodyStart());
sb.Append("<ul>");
sb.Append(@"<li><a href=""/hello.html"">Static Files</a> - requires UseStaticFiles</li>");
sb.Append(@"<li><a href=""/RequestAndResponse"">Request and Response</a>");
Expand Down Expand Up @@ -272,6 +276,7 @@ await context.Response.WriteAsync(
sb.Append("</ul>");
sb.Append("</li>");
sb.Append("</ul>");
sb.Append(HtmlHelper.BodyEnd() + HtmlHelper.HtmlEnd());
await context.Response.WriteAsync(sb.ToString());
});

Expand Down
28 changes: 14 additions & 14 deletions ASPNET/WebSampleApp/src/WebSampleApp/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@
},
"dependencies": {
"Microsoft.NETCore.App": {
"version": "1.0.1",
"version": "1.1.0",
"type": "platform"
},
"Microsoft.AspNetCore.Server.IISIntegration": "1.0.0",
"Microsoft.AspNetCore.Server.Kestrel": "1.0.1",
"Microsoft.AspNetCore.Session": "1.0.0",
"Microsoft.AspNetCore.StaticFiles": "1.0.0",
"Microsoft.Extensions.Caching.Abstractions": "1.0.0",
"Microsoft.Extensions.Caching.Memory": "1.0.0",
"Microsoft.Extensions.Configuration": "1.0.0",
"Microsoft.Extensions.Configuration.Json": "1.0.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.0.0",
"Microsoft.Extensions.Logging": "1.0.0",
"Microsoft.Extensions.Logging.Console": "1.0.0",
"Microsoft.Extensions.Logging.Debug": "1.0.0",
"Newtonsoft.Json": "9.0.1"
"Microsoft.AspNetCore.Server.IISIntegration": "1.1.0",
"Newtonsoft.Json": "9.0.1",
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
"Microsoft.AspNetCore.Session": "1.1.0",
"Microsoft.AspNetCore.StaticFiles": "1.1.0",
"Microsoft.Extensions.Caching.Abstractions": "1.1.0",
"Microsoft.Extensions.Caching.Memory": "1.1.0",
"Microsoft.Extensions.Configuration": "1.1.0",
"Microsoft.Extensions.Configuration.Json": "1.1.0",
"Microsoft.Extensions.Configuration.UserSecrets": "1.1.0",
"Microsoft.Extensions.Logging": "1.1.0",
"Microsoft.Extensions.Logging.Console": "1.1.0",
"Microsoft.Extensions.Logging.Debug": "1.1.0"
},
"tools": {
"Microsoft.AspNetCore.Server.IISIntegration.Tools": {
Expand Down
2 changes: 2 additions & 0 deletions BookUpdates.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Page 76 - typo: *_* missing with _firstName variable within get accessor

Page 84 - typo: new MySingleton(42) should by new Singleton(42)

Page 92 - Constructors for Structs: you cannot define default constructors for structs. This didn't make it into C# 6.

## Chapter 5 - Managed and Unmanaged Resources

Page 124, Note at the end of the page: selecting a 32- or 64-bit build cannot be done by the Debug settings of the project properties. Instead, configure the *runtimes* section within *project.json*.
Expand Down