aspirant-project / aspirant

Extensions for .NET Aspire
MIT License
57 stars 5 forks source link

Add RunWith/PublishWith extensions for all With methods #8

Open DamianEdwards opened 3 months ago

DamianEdwards commented 3 months ago

This has been started but needs to be completed. Idea is that the pattern becomes WithXXX methods apply in all execution modes, whereas RunWithXXX/PublishWithXXX only apply in the associated execution mode, matching the pattern established for AsXXX/RunAsXXX/PublishAsXXX methods.

var cache = builder.AddRedis("cache")
    .RunWithBindMount("./cache-data", "/data")
    .PublishWithVolume("cache-data", "/data")
    .WithPersistence();

var cacheParameter = builder.AddParameter("cache-param");

builder.AddProject<Projects.WebApp>("webapp")
    .RunWithReference(cache)
    .PublishWithParameter(cacheParameter);

Should do it for the resource-specific WithDataVolume/WithDataBindMount, etc. methods too.

DamianEdwards commented 3 months ago

We have the packages for PostgreSQL, SQL Server, and RabbitMQ so we can add the matching methods there too.