You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Proof of concept of persistent container
* Update API
* Update check to internal and mark API as experimental
* Add example for WithContainerLifetime
* Add missing returns doc
* Change AppHost lifetime to Default
// Licensed to the .NET Foundation under one or more agreements.
2
+
// The .NET Foundation licenses this file to you under the MIT license.
3
+
4
+
usingSystem.Diagnostics;
5
+
6
+
namespaceAspire.Hosting.ApplicationModel;
7
+
8
+
/// <summary>
9
+
/// Lifetime modes for container resources
10
+
/// </summary>
11
+
publicenumContainerLifetimeType
12
+
{
13
+
/// <summary>
14
+
/// The default lifetime behavior should apply. This will create the resource when the AppHost starts and dispose of it when the AppHost shuts down.
15
+
/// </summary>
16
+
Default,
17
+
/// <summary>
18
+
/// The resource is persistent and will not be disposed of when the AppHost shuts down.
19
+
/// </summary>
20
+
Persistent,
21
+
}
22
+
23
+
/// <summary>
24
+
/// Annotation that controls the lifetime of a container resource (default behavior that matches the lifetime of the AppHost or a persistent lifetime across AppHost restarts)
@@ -233,4 +233,20 @@ public static int GetReplicaCount(this IResource resource)
233
233
return1;
234
234
}
235
235
}
236
+
237
+
/// <summary>
238
+
/// Gets the lifetime type of the container for the specified resoruce. Defaults to <see cref="ContainerLifetimeType.Default"/> if
239
+
/// no <see cref="ContainerLifetimeAnnotation"/> is found.
240
+
/// </summary>
241
+
/// <param name="resource">The resource to the get the ContainerLifetimeType for.</param>
242
+
/// <returns>The <see cref="ContainerLifetimeType"/> from the <see cref="ContainerLifetimeAnnotation"/> for the resource (if the annotation exists). Defaults to <see cref="ContainerLifetimeType.Default"/> if the annotation is not set.</returns>
/// <param name="builder">Builder for the container resource.</param>
230
+
/// <param name="lifetimeType">The lifetime behavior of the container resource (defaults behavior is <see cref="ContainerLifetimeType.Default"/>)</param>
thrownewInvalidOperationException($"The resource '{builder.Resource.Name}' does not have a container image specified. Use WithImage to specify the container image and tag.");
0 commit comments