DbGateBuilderExtensions Methods
Class Methods 5 members
Provides extension methods for DbGate resources to an
Hosting.IDistributedApplicationBuilder. AddDbGate(IDistributedApplicationBuilder, string, int?) Section titled AddDbGate(IDistributedApplicationBuilder, string, int?) extension IResourceBuilder<DbGateContainerResource> Adds a DbGate container resource to the application.
public static class DbGateBuilderExtensions{ public static IResourceBuilder<DbGateContainerResource> AddDbGate( this IDistributedApplicationBuilder builder, string name = "dbgate", int? port = null) { // ... }}Parameters
builder IDistributedApplicationBuilder The resource builder. name string optional The name of the resource. This name will be used as the connection string name when referenced in a dependency. Optional; defaults to dbgate. port int? optional The host port to bind the underlying container to. Returns
IResourceBuilder<DbGateContainerResource> A reference to the ApplicationModel.IResourceBuilder`1. Remarks
Multiple
DbGateBuilderExtensions.AddDbGate calls will return the same resource builder instance. Sanitizes a resource name to be used as a connection ID in DbGate environment variables.
public static class DbGateBuilderExtensions{ public static string SanitizeConnectionId( string resourceName) { // ... }}Parameters
resourceName string The resource name to sanitize. Returns
string A sanitized connection ID safe for use in environment variable names. Remarks
This method performs basic sanitization by replacing hyphens with underscores, as hyphens are not valid in Linux environment variable names.
Note: Linux environment variable names have additional constraints (must contain only letters, numbers, and underscores, and cannot start with a number). This method does not validate or enforce these additional constraints. Resource names should follow standard naming conventions to ensure compatibility.
WithDataBindMount(IResourceBuilder<DbGateContainerResource>, string, bool) Section titled WithDataBindMount(IResourceBuilder<DbGateContainerResource>, string, bool) extension IResourceBuilder<DbGateContainerResource> Adds a bind mount for the data folder to a DbGate container resource.
public static class DbGateBuilderExtensions{ public static IResourceBuilder<DbGateContainerResource> WithDataBindMount( this IResourceBuilder<DbGateContainerResource> builder, string source, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<DbGateContainerResource> The resource builder. source string The source directory on the host to mount into the container. isReadOnly bool optional A flag that indicates if this is a read-only mount. Returns
IResourceBuilder<DbGateContainerResource> The ApplicationModel.IResourceBuilder`1. WithDataVolume(IResourceBuilder<DbGateContainerResource>, string?, bool) Section titled WithDataVolume(IResourceBuilder<DbGateContainerResource>, string?, bool) extension IResourceBuilder<DbGateContainerResource> Adds a named volume for the data folder to a DbGate container resource.
public static class DbGateBuilderExtensions{ public static IResourceBuilder<DbGateContainerResource> WithDataVolume( this IResourceBuilder<DbGateContainerResource> builder, string? name = null, bool isReadOnly = false) { // ... }}Parameters
builder IResourceBuilder<DbGateContainerResource> The resource builder. name string? optional The name of the volume. Defaults to an auto-generated name based on the application and resource names. isReadOnly bool optional A flag that indicates if this is a read-only volume. Returns
IResourceBuilder<DbGateContainerResource> The ApplicationModel.IResourceBuilder`1. WithHostPort(IResourceBuilder<DbGateContainerResource>, int?) Section titled WithHostPort(IResourceBuilder<DbGateContainerResource>, int?) extension IResourceBuilder<DbGateContainerResource> Configures the host port that the DbGate resource is exposed on instead of using randomly assigned port.
public static class DbGateBuilderExtensions{ public static IResourceBuilder<DbGateContainerResource> WithHostPort( this IResourceBuilder<DbGateContainerResource> builder, int? port) { // ... }}Parameters
builder IResourceBuilder<DbGateContainerResource> The resource builder for DbGate. port int? The port to bind on the host. If null is used random port will be assigned. Returns
IResourceBuilder<DbGateContainerResource> The resource builder for DbGate.