Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
// The expression below is a bit more complex than the average developer app would
// probably have, but in our repo we'll probably want to experiment with seperately
// deployed resources a little bit.
var db = builder.AddSqlServer("sql")
.PublishAsConnectionString()
.AddDatabase("db");
var sql = builder.AddSqlServer("sql");
#pragma warning disable CS0618 // This playground intentionally exercises obsolete manifest-only PublishAsConnectionString behavior.
sql.PublishAsConnectionString();
#pragma warning restore CS0618
var db = sql.AddDatabase("db");

var insertionrows = builder.AddParameter("insertionrows")
.WithDescription("The number of rows to insert into the database.");
Expand Down
4 changes: 4 additions & 0 deletions src/Aspire.Hosting.Azure/AzureResourceExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@ public static class AzureResourceExtensions
/// <typeparam name="T">The resource type.</typeparam>
/// <param name="builder">The resource builder.</param>
/// <returns>The configured <see cref="IResourceBuilder{T}"/>.</returns>
/// <remarks>
/// This API only changes the manifest representation; it does not change the resource model used by other publishers.
/// </remarks>
/// <ats-returns>The resource builder.</ats-returns>
[Obsolete("PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.")]
[AspireExport]
public static IResourceBuilder<T> PublishAsConnectionString<T>(this IResourceBuilder<T> builder)
where T : IAzureResource, IResourceWithConnectionString
Expand Down
4 changes: 4 additions & 0 deletions src/Aspire.Hosting/ParameterResourceBuilderExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,11 @@ internal static IResourceBuilder<IResourceWithConnectionString> AddConnectionStr
/// <typeparam name="T">The resource type.</typeparam>
/// <param name="builder">The resource builder.</param>
/// <returns>The configured <see cref="IResourceBuilder{T}"/>.</returns>
/// <remarks>
/// This API only changes the manifest representation; it does not change the resource model used by other publishers.
/// </remarks>
/// <ats-returns>The resource builder.</ats-returns>
[Obsolete("PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.")]
[AspireExport]
public static IResourceBuilder<T> PublishAsConnectionString<T>(this IResourceBuilder<T> builder)
where T : ContainerResource, IResourceWithConnectionString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14067,7 +14067,10 @@ export interface ContainerResource {
withOtlpExporter(options?: WithOtlpExporterOptions): ContainerResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): ContainerResourcePromise;
/**
Expand Down Expand Up @@ -14808,7 +14811,10 @@ export interface ContainerResourcePromise extends PromiseLike<ContainerResource>
withOtlpExporter(options?: WithOtlpExporterOptions): ContainerResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): ContainerResourcePromise;
/**
Expand Down Expand Up @@ -15909,7 +15915,10 @@ class ContainerResourceImpl extends ResourceBuilderBase<ContainerResourceHandle>

/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): ContainerResourcePromise {
return new ContainerResourcePromiseImpl(this._publishAsConnectionStringInternal(), this._client);
Expand Down Expand Up @@ -37423,7 +37432,10 @@ export interface TestDatabaseResource {
withOtlpExporter(options?: WithOtlpExporterOptions): TestDatabaseResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestDatabaseResourcePromise;
/**
Expand Down Expand Up @@ -38164,7 +38176,10 @@ export interface TestDatabaseResourcePromise extends PromiseLike<TestDatabaseRes
withOtlpExporter(options?: WithOtlpExporterOptions): TestDatabaseResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestDatabaseResourcePromise;
/**
Expand Down Expand Up @@ -39264,7 +39279,10 @@ class TestDatabaseResourceImpl extends ResourceBuilderBase<TestDatabaseResourceH

/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestDatabaseResourcePromise {
return new TestDatabaseResourcePromiseImpl(this._publishAsConnectionStringInternal(), this._client);
Expand Down Expand Up @@ -41924,7 +41942,10 @@ export interface TestRedisResource {
withOtlpExporter(options?: WithOtlpExporterOptions): TestRedisResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestRedisResourcePromise;
/**
Expand Down Expand Up @@ -42729,7 +42750,10 @@ export interface TestRedisResourcePromise extends PromiseLike<TestRedisResource>
withOtlpExporter(options?: WithOtlpExporterOptions): TestRedisResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestRedisResourcePromise;
/**
Expand Down Expand Up @@ -43893,7 +43917,10 @@ class TestRedisResourceImpl extends ResourceBuilderBase<TestRedisResourceHandle>

/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestRedisResourcePromise {
return new TestRedisResourcePromiseImpl(this._publishAsConnectionStringInternal(), this._client);
Expand Down Expand Up @@ -46860,7 +46887,10 @@ export interface TestVaultResource {
withOtlpExporter(options?: WithOtlpExporterOptions): TestVaultResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestVaultResourcePromise;
/**
Expand Down Expand Up @@ -47603,7 +47633,10 @@ export interface TestVaultResourcePromise extends PromiseLike<TestVaultResource>
withOtlpExporter(options?: WithOtlpExporterOptions): TestVaultResourcePromise;
/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestVaultResourcePromise;
/**
Expand Down Expand Up @@ -48705,7 +48738,10 @@ class TestVaultResourceImpl extends ResourceBuilderBase<TestVaultResourceHandle>

/**
* Changes the resource to be published as a connection string reference in the manifest.
*
* This API only changes the manifest representation; it does not change the resource model used by other publishers.
* @returns The resource builder.
* @deprecated PublishAsConnectionString only works with the manifest publisher and is obsolete. Use AddConnectionString in publish-mode app model code instead.
*/
publishAsConnectionString(): TestVaultResourcePromise {
return new TestVaultResourcePromiseImpl(this._publishAsConnectionStringInternal(), this._client);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ public async Task PublishAsConnectionStringConfiguresManifestAsParameter()
{
var builder = DistributedApplication.CreateBuilder();

var redis = builder.AddRedis("redis").PublishAsConnectionString();
#pragma warning disable CS0618 // Test intentionally covers obsolete PublishAsConnectionString manifest behavior.
var redis = builder.AddRedis("redis")
.PublishAsConnectionString();
#pragma warning restore CS0618

Assert.True(redis.Resource.TryGetLastAnnotation<ManifestPublishingCallbackAnnotation>(out _));

Expand Down
Loading