Skip to content

Commit beb0011

Browse files
committed
Auto install dotnet ef
1 parent a519c10 commit beb0011

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,7 @@ It showcases:
2727

2828
### Database
2929

30-
1. Install the **dotnet-ef** tool: `dotnet tool install dotnet-ef -g`
31-
1. Learn more about [dotnet-ef](https://learn.microsoft.com/en-us/ef/core/cli/dotnet)
30+
The application uses SQLite and entity framework. .NET Aspire is used to bootstrap all dependencies.
3231

3332
### Running the application
3433

TodoApp.AppHost/Extensions.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,12 @@ public static IResourceBuilder<ExecutableResource> AddEfMigration<TProject>(this
2525
{
2626
var projectDirectory = Path.GetDirectoryName(new TProject().ProjectPath)!;
2727

28+
// Install the EF tool
29+
var install = builder.AddExecutable("install-ef", "dotnet", projectDirectory, "tool", "install", "--global", "dotnet-ef");
30+
2831
// TODO: Support passing a connection string
29-
return builder.AddExecutable(name, "dotnet", projectDirectory, "ef", "database", "update", "--no-build");
32+
return builder.AddExecutable(name, "dotnet", projectDirectory, "ef", "database", "update", "--no-build")
33+
.WaitForCompletion(install);
3034
}
3135

3236
public static string GetProjectDirectory(this IResourceBuilder<ProjectResource> project) =>

0 commit comments

Comments
 (0)