Skip to content

Conversation

@HofmeisterAn
Copy link
Collaborator

What does this PR do?

This PR introduces two new types to the builder API for resource configuration: ComposableEnumerable<T> and ComposableDictionary<TKey, TValue>. These types give developers the ability to override pre-configured values, something that wasn’t previously possible.

In Testcontainers for .NET, builders are immutable and modules come with opinionated, pre-configured defaults. Some builder APIs only allow extending existing configurations. You couldn't override or completely remove settings that were already defined.

These two new types address that limitation by adding override support to selected APIs.

We're starting with the new WithCommand(ComposableEnumerable<string>) API. This gives developers more flexible control over container command arguments that are pre-configured by default.

For example, to remove all default command arguments:

containerBuilder.WithCommand(new OverwriteEnumerable<string>(Array.Empty<string>()))

You can also replace the default command with specific values by passing them instead of Array.Empty<string>(), or append additional commands using regular WithCommand(string) calls.

Also, you can implement your own behavior by inheriting from the base class and customizing it.

Why is it important?

-

Related issues

@HofmeisterAn HofmeisterAn added the enhancement New feature or request label Aug 4, 2025
@netlify
Copy link

netlify bot commented Aug 4, 2025

Deploy Preview for testcontainers-dotnet ready!

Name Link
🔨 Latest commit 18cf3a8
🔍 Latest deploy log https://app.netlify.com/projects/testcontainers-dotnet/deploys/68922d5fc4e4940008947b38
😎 Deploy Preview https://deploy-preview-1506--testcontainers-dotnet.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@HofmeisterAn HofmeisterAn changed the title Feature/allow override builder configs feat: Add ability to override enumerable builder values Aug 5, 2025
@HofmeisterAn HofmeisterAn added the breaking change Causing compatibility issues label Aug 5, 2025
@HofmeisterAn HofmeisterAn marked this pull request as ready for review August 5, 2025 16:46
@HofmeisterAn HofmeisterAn merged commit 897dfd3 into develop Aug 5, 2025
137 checks passed
@HofmeisterAn HofmeisterAn deleted the feature/allow-override-builder-configs branch August 5, 2025 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change Causing compatibility issues enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: cannot replace command (or any other enumerable)

2 participants