Topic: C# and C++

Professional C# 6 and .NET Core 1.0 (111909660X) cover image

Professional C# 6 and .NET Core 1.0

Christian Nagel
ISBN: 978-1-119-09660-3
Paperback
1536 pages
April 2016
Other Available Formats: E-book
If you are an instructor, you may request an evaluation copy for this title.
Paperback Version: US $60.00 Add to Cart

Do you think you've discovered an error in this book? Please check the list of errata below to see if we've already addressed the error. If not, please submit the error via our Errata Form. We will attempt to verify your error; if you're right, we will post a correction below.

ChapterPageDetailsDatePrint Run
15 Errata in Text
Currently reads:
Now, .NET Native is also available with other .NET Core applications.

Should be:
.NET Native will also be available with other .NET Core applications. However, this feature did not make it into version 1 of .NET Core and will be available with a future version.
2-Jun-16
19 Errata in Text
Just before the title “Building the Application”, this should be added to the preceding section:
The dotnet repl command is not available with Preview 2 of the tools, but it will be available at a later time as an extension.
20 Errata in code
Currently reads:
compilationOptions

Should be:
buildOptions
22 Errata in Text
Currently reads in Note:
…run the application with dotnet restore, dotnet compile, and dotnet run

Should be:
…run the application with dotnet restore, dotnet build, and dotnet run
9 264 Errata in text
Currently Reads:
WriteLine(“\{_name}: car \{e.Car} is new”);

Should Read:
WriteLine($“{_name}: car {e.Car} is new”);
14-Jun-16
13 370 Errata in text
Text before the summary currently reads:
Expression<Func<TSource, bool>gt;
Should Read:
Expression<Func<TSource, bool> >
30-Jun-16
16 437 Errata in code
In second code block (project.json):
currently reads
“compilationOptions”: {

should be
“buildOptions”: {
6-Jun-16
16 437 Errata in code
In third code block (Program.cs) ? assembly loading is now easier
Currently reads
private static object GetCalculator()
{
  IAssemblyLoadContext  loadContext = PlatformServices.Default.AssemblyLoadContext.Default;
  using (PlatformServices.DefaultAssemblyLoaderContainer.AddLoader(
    new DirectoryLoader(CalculatorLibPath, loadContext)))
  {
    Assembly assembly = Assembly.Load(new AssemblyName(CalculatorLibName));
    Type type = assembly.GetType(CalculatorTypeName);
    return Activator.CreateInstance(type);
  }
}

should read
private static object GetCalculator()
{
  Assembly assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(CalculatorLibPath);
  Type type = assembly.GetType(CalculatorTypeName);
  return Activator.CreateInstance(type);
}

6-Jun-16
24 697 Errata in code
In code block in the lower part of the page
Currently reads

public static MySafe InitProtection() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDataProtection(); serviceCollection.ConfigureDataProtection(c => c.PersistKeysToFileSystem(new DirectoryInfo(".")) .SetDefaultKeyLifetime(TimeSpan.FromDays(20)) .ProtectKeysWithDpapi() ); IServiceProvider services = serviceCollection.BuildServiceProvider(); return ActivatorUtilities.CreateInstance(services); }

Should read

public static MySafe InitProtection() { var serviceCollection = new ServiceCollection(); serviceCollection.AddDataProtection() .PersistKeysToFileSystem(new DirectoryInfo(".")) .SetDefaultKeyLifetime(TimeSpan.FromDays(20)) .ProtectKeysWithDpapi(); IServiceProvider services = serviceCollection.BuildServiceProvider(); return ActivatorUtilities.CreateInstance(services); }

6-Jun-16
38 1166 Errata in code
In Entity Framework
Currently reads:
public class BooksContext : DbContext
{
  public DbSet Books { get; set; }
}

should read
public class BooksContext : DbContext
{
  public BooksContext(DbContextOptions options)
    : base(options)
  {          
  }
  public DbSet Books { get; set; }
}

6-Jun-16
38 1169 Errata in code
In bottom of page
Currently reads
"tools": {
 "dotnet-ef": "1.0.0-*"
}
Should read
"tools": {
  "Microsoft.EntityFrameworkCore.Tools": {
   "version": "1.0.0-*",
   "imports": "portable-net452+win81"
  }
}

6-Jun-16
40 1248 Errata in Text
In the section before the first code snippet:
Text currently reads:
?add the NuGet package Microsoft.AspNet.Session.
Should be:
?add the NuGet package Microsoft.AspNetCore.Session.
40 1248 Errata in Text
In the section before the first code snippet:
Text currently reads:
?method AddCaching adds the following cache service?
Should read:
?method AddDistributedCache adds the cache service?
4-Jan-17
40 1248 Errata in code
In the first code snippet:
Currently reads:
services.AddCaching();
Should read:
services.AddDistributedCache();
4-Jan-17
1332 Errata in Text
In text before the first code snippet
Currently reads:
ConfigureSwaggerDocument configures the title, description, and the API version. ConfigureSwaggerSchema defines how the generated JSON schema should look.
Should read:
ConfigureSwaggerGen configures the title, description, and the API version, and how the generated JSON schema should look.
13-7-16
1332 Errata in code
The first code snippet:
Currently reads:
services.ConfigureSwaggerDocument(options =>
{
  options.SingleApiVersion(new Info
  {
    Version = "v1",
    Title = "Book Chapters",
    Description = "A sample for Professional C# 6"
  });
  options.IgnoreObsoleteActions = true;
});
services.ConfigureSwaggerSchema(options => 
{
  options.DescribeAllEnumsAsStrings = true;
  options.IgnoreObsoleteProperties = true;
}

Should read:
services.ConfigureSwaggerGen(options =>
{
  options.SingleApiVersion(new Info
  {
    Version = "v1",
    Title = "Book Chapters",
    Description = "A sample for Professional C# 6"
  });
  options.IgnoreObsoleteActions();
  options.IgnoreObsoleteProperties();
  options.DescribeAllEnumsAsStrings();
});

13-7-16
1332 Errata in Text
Text before the second code snippet:
Currently reads:
The extension method UseSwaggerGen specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwaggerGen is…
Should read:
The extension method UseSwagger specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwagger is…
13-7-16
1332 Errata in Text
Text before the second code snippet:
Currently reads:
The extension method UseSwaggerGen specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwaggerGen is…
Should read:
The extension method UseSwagger specifies that a JSON schema file should be generated. The default URI that you can configure with UseSwagger is…
13-7-16
1332 Errata in code
And the second code snippet on page 1332
Currently reads:
app.UseSwaggerGen();
app.UseSwaggerUI();

Should read:
app.UseSwagger();
app.UseSwaggerUI();

13-7-16