Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update WithArgs to accept object array #4237

Closed
afscrome opened this issue May 20, 2024 · 1 comment · Fixed by #4415
Closed

Update WithArgs to accept object array #4237

afscrome opened this issue May 20, 2024 · 1 comment · Fixed by #4415
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Milestone

Comments

@afscrome
Copy link
Contributor

I'd like to be able to do the following

builder
  .AddExecutable(...)
  .WithEndpoint(name: "endpoint")
  .WithArgs("-p", builder.Resource.GetEndpoint("endpoint").Property(EndpointProperty.Port));

But this doesn't work as the WithArgs callback only accepts string array params -

public static IResourceBuilder<T> WithArgs<T>(this IResourceBuilder<T> builder, params string[] args) where T : IResourceWithArgs
{
return builder.WithArgs(context => context.Args.AddRange(args));
}

For now, can work around this with the callback overload that does accept objects

return builder
  .AddExecutable(...)
  .WithArgs(context =>{
      context.Args.Add("-p");
      context.Args.Add(builder.Resource.GetEndpoint(endpointName).Property(EndpointProperty.TargetPort));
    });
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label May 20, 2024
@mitchdenny mitchdenny added this to the Backlog milestone Jun 8, 2024
@mitchdenny
Copy link
Member

Sounds reasonable. I'm putting on the backlog for now.

@github-actions github-actions bot locked and limited conversation to collaborators Oct 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants