Intermezzo–2 Aspire Extensions modified

In order to can make videos for the VacationRelay , I had to modify 2 Aspire Extensions

1.  https://www.nuget.org/packages/PortExtensionsAspire

For an unknown reason( unknown – because I do not like to investigate ) , Adminer extension for Aspire didn’t like the port assigned , but it likes 13456( And the port was useful to send to Playwright to make video tutorials …)

So I modified the Aspire extension to support

var ports = builder.AddPort()
    .WithDeterministicPortEnvironment("postgres","sqliteweb", "mongodb", "FileDisplay")
    .WithDeterministicPortEnvironment("sqlserver",13456)
    .Construct();

// and later add to playwright environemnt 
var jsTest = builder
    .AddJavaScriptApp("jsTest", "../VR.TestUI")    
     .AddNpmCommandsFromPackage()
     .WithPortReference(ports)     
     ;

2. https://www.nuget.org/packages/AspireFileDisplayExtension

For each of tutorials with SqlServer, Sqlite, Postgres, Mongo I need to display the same file – AppHost.cs, but with different things underlined ( such as adding to Aspire the different databases )

So now I added a name, with default on the name of the file, but can be changed

files.AddFile(relativePath: "AppHost.cs",name:"sqlite", lines: ["builder.AddSqlite", ".ExecuteDBScripts(ScriptsData.GetScripts(DatabaseType.Sqlite));"]);
files.AddFile(relativePath: "AppHost.cs", name: "mongodb", lines: ["builder.AddMongoDB", "ExecuteDBScripts(ScriptsData.GetScripts(DatabaseType.MongoDB))"]);
files.AddFile(relativePath: "AppHost.cs", name: "sqlserver", lines: ["builder.AddSqlServer", "ExecuteSqlServerScriptsAtStartup(ScriptsData.GetScripts(DatabaseType.SqlServer))"]);
files.AddFile(relativePath: "AppHost.cs", name: "postgres", lines: ["builder.AddPostgres", "ExecuteDBScripts(ScriptsData.GetScripts(DatabaseType.Postgres))"]);


Posted

in

by

Tags: