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
18 changes: 18 additions & 0 deletions CSharp7/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Readme - Code Samples for Chapter 47, C# 7.0 - What's New!

This chapter contains the following code sample:

* CSharp7Samples

Get the downloadable book chapter: [C# 7.0 - What's New?](https://csharp.christiannagel.com/2017/04/03/csharp7/)

To build and run the .NET Core samples, please install
* Visual Studio 2017 with the .NET Core workload

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

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

Please check my blog [csharp.christiannagel.com](https://csharp.christiannagel.com "csharp.christiannagel.com") for additional information for topics covered in the book.

Thank you!
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,4 @@
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="1.1.0" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,4 @@
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
</ItemGroup>

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="1.1.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="1.1.1" />
</ItemGroup>

Expand Down

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
Expand Up @@ -19,7 +19,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
{
MenuCardId = table.Column<int>(nullable: false)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
Title = table.Column<string>(nullable: true)
Title = table.Column<string>(maxLength: 50, nullable: true)
},
constraints: table =>
{
Expand All @@ -35,7 +35,7 @@ protected override void Up(MigrationBuilder migrationBuilder)
.Annotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn),
MenuCardId = table.Column<int>(nullable: false),
Price = table.Column<decimal>(type: "Money", nullable: false),
Text = table.Column<string>(nullable: true)
Text = table.Column<string>(maxLength: 120, nullable: true)
},
constraints: table =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
{
modelBuilder
.HasDefaultSchema("mc")
.HasAnnotation("ProductVersion", "1.0.0-rc2-20901")
.HasAnnotation("ProductVersion", "1.1.1")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);

modelBuilder.Entity("MenusSample.Menu", b =>
Expand All @@ -28,7 +28,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.HasColumnType("Money");

b.Property<string>("Text")
.HasAnnotation("MaxLength", 120);
.HasMaxLength(120);

b.HasKey("MenuId");

Expand All @@ -43,7 +43,7 @@ protected override void BuildModel(ModelBuilder modelBuilder)
.ValueGeneratedOnAdd();

b.Property<string>("Title")
.HasAnnotation("MaxLength", 50);
.HasMaxLength(50);

b.HasKey("MenuCardId");

Expand All @@ -52,8 +52,8 @@ protected override void BuildModel(ModelBuilder modelBuilder)

modelBuilder.Entity("MenusSample.Menu", b =>
{
b.HasOne("MenusSample.MenuCard")
.WithMany()
b.HasOne("MenusSample.MenuCard", "MenuCard")
.WithMany("Menus")
.HasForeignKey("MenuCardId")
.OnDelete(DeleteBehavior.Cascade);
});
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ Samples available for these chapters (sample folders):
* Chapter 43 - WebHooks and SignalR (SignalRAndWebHooks) [Windows]
* Chapter 44 - Windows Communication Foundation (WCF) [Windows]
* Chapter 45 - Deploying Websites and Services (DeploymentWeb)
* Chapter 46 - .NET Core with csproj - only for download (csproj)
* Chapter 47 - C# 7.0 - What's New? - only for download (CSharp7)

Download the extra Chapters for [C# 7.0](https://csharp.christiannagel.com/2017/04/03/csharp7/) and .NET Core with csproj - coming soon!

You can find additional samples in the [More Samples repository](https://github.com/ProfessionalCSharp/MoreSamples).

Expand Down
23 changes: 23 additions & 0 deletions csproj/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"version": "0.2.0",
"configurations": [
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build",
"program": "${workspaceRoot}\\HelloWorld\\bin\\Debug\\netcoreapp1.1\\HelloWorld.dll",
"args": [],
"cwd": "${workspaceRoot}\\HelloWorld",
"console": "internalConsole",
"stopAtEntry": false,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": ".NET Core Attach",
"type": "coreclr",
"request": "attach",
"processId": "${command:pickProcess}"
}
]
}
16 changes: 16 additions & 0 deletions csproj/.vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"version": "0.1.0",
"command": "dotnet",
"isShellCommand": true,
"args": [],
"tasks": [
{
"taskName": "build",
"args": [
"${workspaceRoot}\\HelloWorld\\HelloWorld.csproj"
],
"isBuildCommand": true,
"problemMatcher": "$msCompile"
}
]
}
Loading