cs11dotnet7/docs/errata/improvements.md

34 lines
2.1 KiB
Markdown
Raw Normal View History

2023-01-07 10:56:14 +01:00
**Improvements** (2 items)
2022-10-11 13:23:13 +02:00
If you have suggestions for improvements, then please [raise an issue in this repository](https://github.com/markjprice/cs11dotnet7/issues) or email me at markjprice (at) gmail.com.
2023-01-07 10:56:14 +01:00
- [Page 153 - Writing a function that returns a value](#page-153---writing-a-function-that-returns-a-value)
- [Page 453 - Scaffolding models using an existing database](#page-453---scaffolding-models-using-an-existing-database)
2022-10-11 13:23:13 +02:00
2023-01-07 10:56:14 +01:00
# Page 153 - Writing a function that returns a value
2022-11-09 15:41:43 +01:00
At the end of this section there is a note box that explains that we could use the `C` format code to format the output as currency. If you are running on a computer in a culture that uses Euros then to show the Euro currency symbol you must enable UTF-8 encoding.
Add the following statement near the top of the code file before doing any writing to the console:
```cs
Console.OutputEncoding = System.Text.Encoding.UTF8;
```
2022-10-11 13:23:13 +02:00
2023-01-07 10:56:14 +01:00
# Page 453 - Scaffolding models using an existing database
2023-01-07 11:01:27 +01:00
In Step 2, I show text that must be entered as a single line at the command-line, as shown in the following command formatted as in the print book:
2023-01-07 10:56:14 +01:00
```
dotnet ef dbcontext scaffold "Filename=Northwind.db" Microsoft.
EntityFrameworkCore.Sqlite --table Categories --table Products --output-
dir AutoGenModels --namespace WorkingWithEFCore.AutoGen --data-
annotations --context Northwind
```
2023-01-07 11:08:33 +01:00
I recommend that you type from the print book or copy and paste long commands like this from the eBook into a plain text editor like Notepad. Then make sure that the whole command is properly formatted as a single line with correct spacing, before you then copy and paste it to the command-line. Copying and pasting directly from the eBook is likely to include newline characters and missing spaces and so on that break the command.
For convenience, here is the same command as a single line to make it easier to copy and paste:
2023-01-07 11:01:27 +01:00
```
dotnet ef dbcontext scaffold "Filename=Northwind.db" Microsoft.EntityFrameworkCore.Sqlite --table Categories --table Products --output-dir AutoGenModels --namespace WorkingWithEFCore.AutoGen --data-annotations --context Northwind
```