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: entity-framework/core/miscellaneous/cli/dbcontext-creation.md
+2-2
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ If your startup project uses the [ASP.NET Core Web Host][3] or [.NET Core Generi
17
17
18
18
The tools first try to obtain the service provider by invoking `Program.CreateHostBuilder()`, calling `Build()`, then accessing the `Services` property.
> When you create a new ASP.NET Core application, this hook is included by default.
@@ -32,7 +32,7 @@ If the DbContext can't be obtained from the application service provider, the to
32
32
33
33
You can also tell the tools how to create your DbContext by implementing the `IDesignTimeDbContextFactory<TContext>` interface: If a class implementing this interface is found in either the same project as the derived `DbContext` or in the application's startup project, the tools bypass the other ways of creating the DbContext and use the design-time factory instead.
Copy file name to clipboardExpand all lines: entity-framework/core/miscellaneous/cli/services.md
+42-2
Original file line number
Diff line number
Diff line change
@@ -2,11 +2,51 @@
2
2
title: Design-time services - EF Core
3
3
description: Information on Entity Framework Core design-time services
4
4
author: bricelam
5
-
ms.date: 10/26/2017
5
+
ms.date: 10/22/2020
6
6
uid: core/miscellaneous/cli/services
7
7
---
8
8
# Design-time services
9
9
10
10
Some services used by the tools are only used at design time. These services are managed separately from EF Core's runtime services to prevent them from being deployed with your app. To override one of these services (for example the service to generate migration files), add an implementation of `IDesignTimeServices` to your startup project.
Microsoft.EntityFrameworkCore.Design is a DevelopmentDependency package. This means that the dependency won't flow transitively into other projects, and that you cannot, by default, reference its types.
17
+
18
+
In order to reference its types and override design-time services, update the PackageReference item's metadata in your project file.
If the package is being referenced transitively via Microsoft.EntityFrameworkCore.Tools, you will need to add an explicit PackageReference to the package and change its metadata.
29
+
30
+
## List of services
31
+
32
+
The following is a list of the design-time services.
<xref:Microsoft.EntityFrameworkCore.Scaffolding.IReverseEngineerScaffolder> | The main class for scaffolding reverse engineered models.
45
+
46
+
## Using services
47
+
48
+
These services can also be useful for creating your own tools. For example, when you want to automate part of you design-time workflow.
49
+
50
+
You can build a service provider containing these services using the AddEntityFrameworkDesignTimeServices and AddDbContextDesignTimeServices extension methods.
0 commit comments