liveBook · Manning

Persistent lifetime

As explained in Building Distributed Applications that Work

A persistent lifetime is a resource-lifecycle setting that preserves a resource instance for reuse across application runs.

A persistent lifetime reuses a SQL Server container instance across runs of an orchestrated application. Without it, each run starts a new container and destroys the old one with its data. This setting supports convenient local database hosting; production guidance favors a managed database, with containers for development and managed instances for production as one hybrid approach. section 3.3

WithLifetime(ContainerLifetime.Persistent)

Set the SQL Server container lifetime to persistent. section 3.3

How Building Distributed Applications that Work covers it

How deep it goes
Describes the container-reuse behavior and its data-loss consequence when a new instance replaces the old one.
Examples
Shows `WithLifetime(ContainerLifetime.Persistent)` when registering a SQL Server resource.
What you can do after
Configure an Aspire SQL Server container to reuse its instance across application runs with `WithLifetime(ContainerLifetime.Persistent)`.
How it connects
Connects SQL Server containers with Docker, data volumes, and managed databases.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Distributed Applications that Work. The section links point to the parts of the book it draws on.