From d0f9b25c5d2100c56770a398e965b06366d134ca Mon Sep 17 00:00:00 2001 From: Jeremy Likness Date: Fri, 10 Dec 2021 14:24:27 -0800 Subject: [PATCH 1/2] Update scaffolding.md --- entity-framework/core/managing-schemas/scaffolding.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entity-framework/core/managing-schemas/scaffolding.md b/entity-framework/core/managing-schemas/scaffolding.md index df25427b03..2ce25ad7c0 100644 --- a/entity-framework/core/managing-schemas/scaffolding.md +++ b/entity-framework/core/managing-schemas/scaffolding.md @@ -9,11 +9,11 @@ uid: core/managing-schemas/scaffolding Reverse engineering is the process of scaffolding entity type classes and a DbContext class based on a database schema. It can be performed using the `Scaffold-DbContext` command of the EF Core Package Manager Console (PMC) tools or the `dotnet ef dbcontext scaffold` command of the .NET Command-line Interface (CLI) tools. -## Installing +## Prerequisites -Before reverse engineering, you'll need to install either the [PMC tools](xref:core/cli/powershell) (Visual Studio only) or the [CLI tools](xref:core/cli/dotnet). See links for details. - -You'll also need to install an appropriate [database provider](xref:core/providers/index) for the database schema you want to reverse engineer. +- Before reverse engineering, you'll need to install either the [PMC tools](xref:core/cli/powershell) (Visual Studio only) or the [CLI tools](xref:core/cli/dotnet). See links for details. +- Install the NuGet package for `Microsoft.EntityFramework.Design` in the project you are scaffolding to. +- You'll also need to install an appropriate [database provider](xref:core/providers/index) for the database schema you want to reverse engineer. ## Connection string From 01df3321629e8d38d49f8f564c6d03f11848f993 Mon Sep 17 00:00:00 2001 From: Jeremy Likness Date: Fri, 10 Dec 2021 14:26:57 -0800 Subject: [PATCH 2/2] Update scaffolding.md fix legacy issue picked up by linter --- entity-framework/core/managing-schemas/scaffolding.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entity-framework/core/managing-schemas/scaffolding.md b/entity-framework/core/managing-schemas/scaffolding.md index 2ce25ad7c0..27994ff91f 100644 --- a/entity-framework/core/managing-schemas/scaffolding.md +++ b/entity-framework/core/managing-schemas/scaffolding.md @@ -148,10 +148,10 @@ Finally, the model is used to generate code. The corresponding entity type class ## Limitations -* Not everything about a model can be represented using a database schema. For example, information about [**inheritance hierarchies**](xref:core/modeling/inheritance), [**owned types**](xref:core/modeling/owned-entities), and [**table splitting**](xref:core/modeling/table-splitting) are not present in the database schema. Because of this, these constructs will never be reverse engineered. -* In addition, **some column types** may not be supported by the EF Core provider. These columns won't be included in the model. -* You can define [**concurrency tokens**](xref:core/modeling/concurrency), in an EF Core model to prevent two users from updating the same entity at the same time. Some databases have a special type to represent this type of column (for example, rowversion in SQL Server) in which case we can reverse engineer this information; however, other concurrency tokens will not be reverse engineered. -* Prior to EF Core 6, [the C# 8 nullable reference type feature](/dotnet/csharp/tutorials/nullable-reference-types) wasn't unsupported in reverse engineering: EF Core always generated C# code that assumed the feature is disabled. For example, nullable text columns were scaffolded as a property with type `string` , not `string?`, with either the Fluent API or Data Annotations used to configure whether a property is required or not. If using an older version of EF Core, you can still edit the scaffolded code and replace these with C# nullability annotations. +- Not everything about a model can be represented using a database schema. For example, information about [**inheritance hierarchies**](xref:core/modeling/inheritance), [**owned types**](xref:core/modeling/owned-entities), and [**table splitting**](xref:core/modeling/table-splitting) are not present in the database schema. Because of this, these constructs will never be reverse engineered. +- In addition, **some column types** may not be supported by the EF Core provider. These columns won't be included in the model. +- You can define [**concurrency tokens**](xref:core/modeling/concurrency), in an EF Core model to prevent two users from updating the same entity at the same time. Some databases have a special type to represent this type of column (for example, rowversion in SQL Server) in which case we can reverse engineer this information; however, other concurrency tokens will not be reverse engineered. +- Prior to EF Core 6, [the C# 8 nullable reference type feature](/dotnet/csharp/tutorials/nullable-reference-types) wasn't unsupported in reverse engineering: EF Core always generated C# code that assumed the feature is disabled. For example, nullable text columns were scaffolded as a property with type `string` , not `string?`, with either the Fluent API or Data Annotations used to configure whether a property is required or not. If using an older version of EF Core, you can still edit the scaffolded code and replace these with C# nullability annotations. ## Customizing the model