Skip to content

Commit 5ab47f3

Browse files
Sc7-gitpranavkm
andauthored
Update Program.cs (#32010)
* Update Program.cs An error is reported when executing the migration command: Unable to create an object of type'ApplicationDbContext'. For the different patterns supported at design time, see https://go.microsoft.com/fwlink/?linkid=851728 The entry point of dbcontext design is Program.CreateHostBuilder(), but the Program class does not have a CreateHostBuilder function. Reference: https://docs.microsoft.com/en-us/ef/core/cli/dbcontext-creation?tabs=vs#from-application-services * Update src/Identity/samples/IdentitySample.Mvc/Program.cs Co-authored-by: Pranav K <[email protected]>
1 parent f35eb17 commit 5ab47f3

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/Identity/samples/IdentitySample.Mvc/Program.cs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,16 @@ public static class Program
77
{
88
public static void Main(string[] args)
99
{
10-
var host = new WebHostBuilder()
11-
.UseKestrel()
12-
.UseContentRoot(Directory.GetCurrentDirectory())
13-
.UseIISIntegration()
14-
.UseStartup<Startup>()
15-
.Build();
1610

11+
var host = CreateHostBuilder(args).Build();
1712
host.Run();
1813
}
14+
15+
public static IWebHostBuilder CreateHostBuilder(string[] args) =>
16+
new WebHostBuilder()
17+
.UseKestrel()
18+
.UseContentRoot(Directory.GetCurrentDirectory())
19+
.UseIISIntegration()
20+
.UseStartup<Startup>();
1921
}
20-
}
22+
}

0 commit comments

Comments
 (0)