Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,45 @@
var builder = DistributedApplication.CreateBuilder(args);
var idsvr = builder.AddProject<Projects.IdentityServerHost>("identityserverhost");

idsvr.WithCommand(
name: "seed",
displayName: "Seed Database",
executeCommand: async (context) =>
{
var projectMetadata = idsvr.Resource.GetProjectMetadata();
var projectPath = projectMetadata.ProjectPath;
var process = new System.Diagnostics.Process
{
StartInfo = new System.Diagnostics.ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"run --project \"{projectPath}\" --no-build -- /seed",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};

process.Start();
await process.WaitForExitAsync(context.CancellationToken);

if (process.ExitCode == 0)
{
return CommandResults.Success();
}
else
{
var error = await process.StandardError.ReadToEndAsync();
return CommandResults.Failure(error);
}
},
commandOptions: new CommandOptions
{
IconName = "DatabaseArrowUp",
IsHighlighted = true
});

builder.AddProject<Projects.Client>("client")
.WaitFor(idsvr);
builder.Build().Run();
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,45 @@

var idsvr = builder.AddProject<Projects.IdentityServerHost>("identityserverhost");

idsvr.WithCommand(
name: "seed",
displayName: "Seed Database",
executeCommand: async (context) =>
{
var projectMetadata = idsvr.Resource.GetProjectMetadata();
var projectPath = projectMetadata.ProjectPath;
var process = new System.Diagnostics.Process
{
StartInfo = new System.Diagnostics.ProcessStartInfo
{
FileName = "dotnet",
Arguments = $"run --project \"{projectPath}\" --no-build -- /seed",
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
CreateNoWindow = true
}
};

process.Start();
await process.WaitForExitAsync(context.CancellationToken);

if (process.ExitCode == 0)
{
return CommandResults.Success();
}
else
{
var error = await process.StandardError.ReadToEndAsync();
return CommandResults.Failure(error);
}
},
commandOptions: new CommandOptions
{
IconName = "DatabaseArrowUp",
IsHighlighted = true
});

builder.AddProject<Projects.Client>("client")
.WaitFor(idsvr);

Expand Down
Loading
Loading