You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17-13Lines changed: 17 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,8 @@ Scaffold EF Core models using Handlebars templates.
6
6
7
7
## Prerequisites
8
8
9
-
-[Visual Studio 2017](https://www.visualstudio.com/downloads/)15.9 or greater.
10
-
- The .[NET Core 2.2 SDK](https://www.microsoft.com/net/download/core) (version 2.2.100 or greater).
9
+
-[Visual Studio 2019](https://www.visualstudio.com/downloads/)16.3 or greater.
10
+
- The .[NET Core 3.0 SDK](https://www.microsoft.com/net/download/core).
11
11
12
12
## Database Setup
13
13
@@ -21,17 +21,16 @@ Scaffold EF Core models using Handlebars templates.
21
21
## Usage
22
22
23
23
1. Create a new **.NET Core** class library.
24
-
- If necessary, edit the csproj file to update the **TargetFramework** to 2.2.
24
+
- If necessary, edit the csproj file to update the **TargetFramework** to 3.0.
25
25
26
26
> **Note**: Using the EF Core toolchain with a _.NET Standard_ class library is currently not supported. Instead, you can add a .NET Standard class library to the same solution as the .NET Core library, then add existing items and select **Add As Link** to include entity classes.
27
27
28
-
2. Add EF Core SQL Server and Tools NuGet packages.
29
-
- Open the Package Manager Console, select the default project and enter:
4. Remove Class1.cs and add a **ScaffoldingDesignTimeServices** class.
37
36
- Implement `IDesignTimeServices` by adding a `ConfigureDesignTimeServices` method
@@ -122,14 +121,14 @@ public class ScaffoldingDesignTimeServices : IDesignTimeServices
122
121
## Extending the OnModelCreating Method
123
122
124
123
There are times when you might like to modify generated code, for example, by adding a `HasConversion` method to an entity property in the `OnModelCreating` method of the generated class that extends `DbContext`. However, doing so may prove futile because added code would be overwritten the next time you run the `dotnet ef dbcontext scaffold` command.
125
-
- Rather than modifying generated code, a better idea would be to extend it by using _partial classes and methods_. To enable this scenario, the generated `DbContext` class is already defined using the `partial` keyword, and it contains a partial `OnModelCreatingExt` method that is invoked at the end of the `OnModelCreating` method.
126
-
- To implement the partial method, simply add a new class to your project with the same name as the generated `DbContext` class, and define it as `partial`. Then add a `OnModelCreatingExt` method with the same signature as the partial method defined in the generated `DbContext` class.
124
+
- Rather than modifying generated code, a better idea would be to extend it by using _partial classes and methods_. To enable this scenario, the generated `DbContext` class is already defined using the `partial` keyword, and it contains a partial `OnModelCreatingPartial` method that is invoked at the end of the `OnModelCreating` method.
125
+
- To implement the partial method, simply add a new class to your project with the same name as the generated `DbContext` class, and define it as `partial`. Then add a `OnModelCreatingPartial` method with the same signature as the partial method defined in the generated `DbContext` class.
127
126
128
127
```csharp
129
-
// Place in separate class file (NorthwindSlimContextExt.cs)
128
+
// Place in separate class file (NorthwindSlimContextPartial.cs)
0 commit comments