File tree Expand file tree Collapse file tree
v7/UserInteraction/DynamicProviders/IdentityServer.AppHost
v8/UserInteraction/DynamicProviders
IdentityServerHost/Migrations/ConfigurationDb Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11var builder = DistributedApplication . CreateBuilder ( args ) ;
22var idsvr = builder . AddProject < Projects . IdentityServerHost > ( "identityserverhost" ) ;
3+
4+ idsvr . WithCommand (
5+ name : "seed" ,
6+ displayName : "Seed Database" ,
7+ executeCommand : async ( context ) =>
8+ {
9+ var projectMetadata = idsvr . Resource . GetProjectMetadata ( ) ;
10+ var projectPath = projectMetadata . ProjectPath ;
11+ var process = new System . Diagnostics . Process
12+ {
13+ StartInfo = new System . Diagnostics . ProcessStartInfo
14+ {
15+ FileName = "dotnet" ,
16+ Arguments = $ "run --project \" { projectPath } \" --no-build -- /seed",
17+ UseShellExecute = false ,
18+ RedirectStandardOutput = true ,
19+ RedirectStandardError = true ,
20+ CreateNoWindow = true
21+ }
22+ } ;
23+
24+ process . Start ( ) ;
25+ await process . WaitForExitAsync ( context . CancellationToken ) ;
26+
27+ if ( process . ExitCode == 0 )
28+ {
29+ return CommandResults . Success ( ) ;
30+ }
31+ else
32+ {
33+ var error = await process . StandardError . ReadToEndAsync ( ) ;
34+ return CommandResults . Failure ( error ) ;
35+ }
36+ } ,
37+ commandOptions : new CommandOptions
38+ {
39+ IconName = "DatabaseArrowUp" ,
40+ IsHighlighted = true
41+ } ) ;
42+
343builder . AddProject < Projects . Client > ( "client" )
444 . WaitFor ( idsvr ) ;
545builder . Build ( ) . Run ( ) ;
Original file line number Diff line number Diff line change 22
33var idsvr = builder . AddProject < Projects . IdentityServerHost > ( "identityserverhost" ) ;
44
5+ idsvr . WithCommand (
6+ name : "seed" ,
7+ displayName : "Seed Database" ,
8+ executeCommand : async ( context ) =>
9+ {
10+ var projectMetadata = idsvr . Resource . GetProjectMetadata ( ) ;
11+ var projectPath = projectMetadata . ProjectPath ;
12+ var process = new System . Diagnostics . Process
13+ {
14+ StartInfo = new System . Diagnostics . ProcessStartInfo
15+ {
16+ FileName = "dotnet" ,
17+ Arguments = $ "run --project \" { projectPath } \" --no-build -- /seed",
18+ UseShellExecute = false ,
19+ RedirectStandardOutput = true ,
20+ RedirectStandardError = true ,
21+ CreateNoWindow = true
22+ }
23+ } ;
24+
25+ process . Start ( ) ;
26+ await process . WaitForExitAsync ( context . CancellationToken ) ;
27+
28+ if ( process . ExitCode == 0 )
29+ {
30+ return CommandResults . Success ( ) ;
31+ }
32+ else
33+ {
34+ var error = await process . StandardError . ReadToEndAsync ( ) ;
35+ return CommandResults . Failure ( error ) ;
36+ }
37+ } ,
38+ commandOptions : new CommandOptions
39+ {
40+ IconName = "DatabaseArrowUp" ,
41+ IsHighlighted = true
42+ } ) ;
43+
544builder . AddProject < Projects . Client > ( "client" )
645 . WaitFor ( idsvr ) ;
746
You can’t perform that action at this time.
0 commit comments