AzureRedisExtensions.RunAsContainer Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Configures an Azure Cache for Redis resource to run locally in a container.
public static Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureRedisCacheResource> RunAsContainer (this Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureRedisCacheResource> builder, Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource>>? configureContainer = default);
static member RunAsContainer : Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureRedisCacheResource> * Action<Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.ApplicationModel.RedisResource>> -> Aspire.Hosting.ApplicationModel.IResourceBuilder<Aspire.Hosting.Azure.AzureRedisCacheResource>
<Extension()>
Public Function RunAsContainer (builder As IResourceBuilder(Of AzureRedisCacheResource), Optional configureContainer As Action(Of IResourceBuilder(Of RedisResource)) = Nothing) As IResourceBuilder(Of AzureRedisCacheResource)
Parameters
- builder
- IResourceBuilder<AzureRedisCacheResource>
The Azure Cache for Redis resource builder.
- configureContainer
- Action<IResourceBuilder<RedisResource>>
Callback that exposes underlying container to allow for customization.
Returns
A reference to the IResourceBuilder<T> builder.
Examples
The following example creates an Azure Cache for Redis resource that runs locally in a Redis container and referencing that resource in a .NET project.
var builder = DistributedApplication.CreateBuilder(args);
var cache = builder.AddAzureRedis("cache")
.RunAsContainer();
builder.AddProject<Projects.ProductService>()
.WithReference(cache);
builder.Build().Run();