VolumeResourceBuilderExtensions Methods
ClassMethods1 member
Provides extension methods for adding volume-backed storage to compute resources.
WithVolume(IResourceBuilder<T>, string, string, string, bool) Section titled WithVolume(IResourceBuilder<T>, string, string, string, bool)extensionI Adds a volume to a compute resource and exposes its effective path through an environment variable.
public static class VolumeResourceBuilderExtensions{ public static IResourceBuilder<T> WithVolume<T>( this IResourceBuilder<T> builder, string name, string target, string env, bool isReadOnly = false) { // ... }}Parameters
builderInamestringThe name of the volume.targetstringThe target path where the volume is mounted after publishing.envstringThe environment variable that receives the effective volume path.isReadOnly booloptionalA flag that indicates if the published volume should be mounted as read-only.Returns
IResourceBuilder<T> The ApplicationModel.IResourceBuilder`1 .Remarks
Containers receive
target in run and publish modes. Projects and executables receive a workload-scoped IAspireStore directory in run mode and target in publish mode. Named storage is independent of the resource lifetime. Session resources stop with the AppHost and reuse their named storage on the next run; persistent resources can keep the compute instance alive and continue using the same storage. Cleaning the AppHost store can remove local project and executable data. Examples
builder.AddProject<Projects.Api>("api") .WithVolume("data", "/usr/data", env: "DATA_PATH");