mirror of
https://github.com/markjprice/cs11dotnet7.git
synced 2025-12-06 05:32:03 +01:00
36 lines
2 KiB
Markdown
36 lines
2 KiB
Markdown
**Improvements** (2 items)
|
|
|
|
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.
|
|
|
|
- [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)
|
|
|
|
# Page 153 - Writing a function that returns a value
|
|
|
|
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;
|
|
```
|
|
|
|
# Page 453 - Scaffolding models using an existing database
|
|
|
|
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:
|
|
```
|
|
dotnet ef dbcontext scaffold "Filename=Northwind.db" Microsoft.
|
|
EntityFrameworkCore.Sqlite --table Categories --table Products --output-
|
|
dir AutoGenModels --namespace WorkingWithEFCore.AutoGen --data-
|
|
annotations --context Northwind
|
|
```
|
|
|
|
Here is the same command as a single line to make it easier to copy and paste:
|
|
```
|
|
dotnet ef dbcontext scaffold "Filename=Northwind.db" Microsoft.EntityFrameworkCore.Sqlite --table Categories --table Products --output-dir AutoGenModels --namespace WorkingWithEFCore.AutoGen --data-annotations --context Northwind
|
|
```
|
|
|
|
I recommend that you copy and paste long commands like this from the eBook into a plain text editor like Notepad, and then make sure that the whole command is properly formatted as a single line, 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.
|