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
@@ -1,5 +1,3 @@
#pragma warning disable ASPIREEXTENSION001 // Type is for evaluation purposes only

var builder = DistributedApplication.CreateBuilder(args);

var weatherApi = builder.AddProject<Projects.AspireJavaScript_MinimalApi>("weatherapi")
Expand Down Expand Up @@ -32,22 +30,20 @@
.WithExternalHttpEndpoints()
.PublishAsDockerFile();

#pragma warning disable ASPIREEXTENSION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.
var reactvite = builder.AddViteApp("reactvite", "../AspireJavaScript.Vite")
.WithReference(weatherApi)
.WithEnvironment("BROWSER", "none")
.WithExternalHttpEndpoints();
#pragma warning restore ASPIREEXTENSION001 // Type is for evaluation purposes only and is subject to change or removal in future updates. Suppress this diagnostic to proceed.

// Demonstrate the new publish methods:

// PublishAsStaticWebsite: deploys the Vite app as a static site served by YARP.
// With apiPath/apiTarget, YARP reverse-proxies /api/* to the weather API via service discovery — no CORS needed.
#pragma warning disable ASPIREEXTENSION001
#pragma warning disable ASPIREJAVASCRIPT001
builder.AddViteApp("vite-static", "../AspireJavaScript.Vite")
.WithExternalHttpEndpoints()
.PublishAsStaticWebsite("/api", weatherApi);
#pragma warning restore ASPIREEXTENSION001
#pragma warning restore ASPIREJAVASCRIPT001

// PublishAsNodeServer: for frameworks that produce a self-contained Node.js server artifact.
// Example: SvelteKit with adapter-node builds to build/index.js, Nuxt/TanStack build to .output/server/index.mjs
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#pragma warning disable ASPIREEXTENSION001
#pragma warning disable ASPIRECERTIFICATES001

using Microsoft.Extensions.Hosting;
Expand Down
25 changes: 0 additions & 25 deletions src/Aspire.Hosting.Azure.Kubernetes/AksSkuTier.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -377,14 +377,6 @@ private static void ConfigureAksInfrastructure(AzureResourceInfrastructure infra
{
var aksResource = (AzureKubernetesEnvironmentResource)infrastructure.AspireResource;

var skuTier = aksResource.SkuTier switch
{
AksSkuTier.Free => ManagedClusterSkuTier.Free,
AksSkuTier.Standard => ManagedClusterSkuTier.Standard,
AksSkuTier.Premium => ManagedClusterSkuTier.Premium,
_ => ManagedClusterSkuTier.Free
};

// Create the AKS managed cluster
var aks = new ContainerServiceManagedCluster(aksResource.GetBicepIdentifier())
{
Expand All @@ -395,7 +387,7 @@ private static void ConfigureAksInfrastructure(AzureResourceInfrastructure infra
Sku = new ManagedClusterSku
{
Name = ManagedClusterSkuName.Base,
Tier = skuTier
Tier = ManagedClusterSkuTier.Free
},
DnsPrefix = $"{aksResource.Name}-dns",
Tags = { { "aspire-resource-name", aksResource.Name } }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Text;
using System.Text.RegularExpressions;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure.Kubernetes;
using Aspire.Hosting.Dcp.Process;
using Aspire.Hosting.Kubernetes;
using Aspire.Hosting.Kubernetes.Resources;
Expand All @@ -17,7 +16,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;

namespace Aspire.Hosting.Azure;
namespace Aspire.Hosting.Azure.Kubernetes;

/// <summary>
/// AKS-specific pipeline step implementations for <see cref="AzureKubernetesEnvironmentResource"/>.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
#pragma warning disable ASPIREPIPELINES001
#pragma warning disable ASPIREAZURE001

using Aspire.Hosting.Azure.Kubernetes;
using Aspire.Hosting.Kubernetes;
using Aspire.Hosting.Pipelines;

namespace Aspire.Hosting.Azure;
namespace Aspire.Hosting.Azure.Kubernetes;

/// <summary>
/// Represents an Azure Kubernetes Service (AKS) environment resource that provisions
Expand Down Expand Up @@ -112,11 +111,6 @@ public AzureKubernetesEnvironmentResource(
/// </summary>
internal string? KubernetesVersion { get; set; }

/// <summary>
/// Gets or sets the SKU tier for the AKS cluster.
/// </summary>
internal AksSkuTier SkuTier { get; set; } = AksSkuTier.Free;

/// <summary>
/// Gets or sets whether OIDC issuer is enabled on the cluster.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Azure;
using Aspire.Hosting.Azure.Kubernetes;
using Aspire.Hosting.Kubernetes;

namespace Aspire.Hosting;
Expand Down
10 changes: 5 additions & 5 deletions src/Aspire.Hosting.EntityFrameworkCore/EFMigrationResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@

using Aspire.Hosting.ApplicationModel;

namespace Aspire.Hosting;
namespace Aspire.Hosting.EntityFrameworkCore;

/// <summary>
/// Represents an EF Core migration resource associated with a project.
/// </summary>
/// <param name="name">The name of the resource.</param>
/// <param name="projectResource">The parent project resource that contains the DbContext.</param>
/// <param name="contextTypeName">The fully qualified name of the DbContext type, or null to auto-detect.</param>
/// <param name="dbContextTypeName">The fully qualified name of the DbContext type, or null to auto-detect.</param>
/// <remarks>
/// The resource inherits from <see cref="ContainerResource"/> so it can be published as a container image
/// that runs the migration bundle at deploy time when
/// <see cref="EFMigrationResourceBuilderExtensions.PublishAsMigrationBundle(ApplicationModel.IResourceBuilder{EFMigrationResource}, string?, bool, bool, string?)"/>
/// <see cref="EFMigrationResourceBuilderExtensions.PublishAsMigrationBundle(IResourceBuilder{EFMigrationResource}, string?, bool, bool, string?)"/>
/// is called with <c>publishContainer: true</c>.
/// </remarks>
[AspireExport(ExposeProperties = true)]
public class EFMigrationResource(string name, ProjectResource projectResource, string? contextTypeName)
public class EFMigrationResource(string name, ProjectResource projectResource, string? dbContextTypeName)
: ContainerResource(name)
{
/// <summary>
Expand All @@ -35,7 +35,7 @@ public class EFMigrationResource(string name, ProjectResource projectResource, s
/// This property is used to specify which DbContext to use when the project contains multiple DbContext types.
/// When null, the EF Core tools will auto-detect the DbContext to use.
/// </remarks>
public string? ContextTypeName { get; } = contextTypeName;
public string? DbContextTypeName { get; } = dbContextTypeName;

/// <summary>
/// Gets or sets whether a migration script should be generated during publishing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#pragma warning disable ASPIREPIPELINES001 // PipelineStepAnnotation is experimental; used to wire migration-bundle pipeline steps.

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.EntityFrameworkCore;
using Aspire.Hosting.Pipelines;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#pragma warning disable ASPIREDOTNETTOOL

using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.EntityFrameworkCore;
using Aspire.Hosting.Pipelines;
using System.Diagnostics;
using System.Text;
Expand Down Expand Up @@ -33,7 +34,7 @@ private static string GetShortTypeName(string? fullTypeName)
/// </summary>
/// <param name="builder">The resource builder for the project.</param>
/// <param name="name">The name of the migration resource.</param>
/// <param name="contextTypeName">The fully qualified name of the DbContext type to manage migrations for.</param>
/// <param name="dbContextTypeName">The fully qualified name of the DbContext type to manage migrations for.</param>
/// <returns>An EF migration resource builder for chaining additional configuration.</returns>
/// <exception cref="InvalidOperationException">Thrown if migrations for this context type have already been added.</exception>
/// <remarks>
Expand All @@ -50,21 +51,21 @@ private static string GetShortTypeName(string? fullTypeName)
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
[ResourceName] string name,
string contextTypeName)
string dbContextTypeName)
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentException.ThrowIfNullOrEmpty(name);
ArgumentException.ThrowIfNullOrEmpty(contextTypeName);
ArgumentException.ThrowIfNullOrEmpty(dbContextTypeName);

return AddEFMigrationsCore(builder, name, contextTypeName, configureToolResource: null);
return AddEFMigrationsCore(builder, name, dbContextTypeName, configureToolResource: null);
}

/// <summary>
/// Adds EF Core migration management for a specific DbContext type identified by name.
/// </summary>
/// <param name="builder">The resource builder for the project.</param>
/// <param name="name">The name of the migration resource.</param>
/// <param name="contextTypeName">The fully qualified name of the DbContext type to manage migrations for.</param>
/// <param name="dbContextTypeName">The fully qualified name of the DbContext type to manage migrations for.</param>
/// <param name="configureToolResource">Optional callback to configure the dotnet-ef tool resource used for migrations.</param>
/// <returns>An EF migration resource builder for chaining additional configuration.</returns>
/// <exception cref="InvalidOperationException">Thrown if migrations for this context type have already been added.</exception>
Expand All @@ -82,14 +83,14 @@ public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
this IResourceBuilder<ProjectResource> builder,
[ResourceName] string name,
string contextTypeName,
string dbContextTypeName,
Action<IResourceBuilder<DotnetToolResource>>? configureToolResource)
{
ArgumentNullException.ThrowIfNull(builder);
ArgumentException.ThrowIfNullOrEmpty(name);
ArgumentException.ThrowIfNullOrEmpty(contextTypeName);
ArgumentException.ThrowIfNullOrEmpty(dbContextTypeName);

return AddEFMigrationsCore(builder, name, contextTypeName, configureToolResource);
return AddEFMigrationsCore(builder, name, dbContextTypeName, configureToolResource);
}

/// <summary>
Expand All @@ -106,7 +107,7 @@ public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
ArgumentNullException.ThrowIfNull(builder);
ArgumentException.ThrowIfNullOrEmpty(name);

return AddEFMigrationsCore(builder, name, contextTypeName: null, configureToolResource: null);
return AddEFMigrationsCore(builder, name, dbContextTypeName: null, configureToolResource: null);
}

/// <summary>
Expand All @@ -125,13 +126,13 @@ public static IResourceBuilder<EFMigrationResource> AddEFMigrations(
ArgumentNullException.ThrowIfNull(builder);
ArgumentException.ThrowIfNullOrEmpty(name);

return AddEFMigrationsCore(builder, name, contextTypeName: null, configureToolResource);
return AddEFMigrationsCore(builder, name, dbContextTypeName: null, configureToolResource);
}

private static IResourceBuilder<EFMigrationResource> AddEFMigrationsCore(
IResourceBuilder<ProjectResource> builder,
string name,
string? contextTypeName,
string? dbContextTypeName,
Action<IResourceBuilder<DotnetToolResource>>? configureToolResource)
{
// Check for duplicate context types and null/non-null conflicts
Expand All @@ -140,15 +141,15 @@ private static IResourceBuilder<EFMigrationResource> AddEFMigrationsCore(
.Where(r => r.ProjectResource == builder.Resource)
.ToList();

if (contextTypeName != null)
if (dbContextTypeName != null)
{
if (existingMigrations.Any(r => r.ContextTypeName == contextTypeName))
if (existingMigrations.Any(r => r.DbContextTypeName == dbContextTypeName))
{
throw new InvalidOperationException(
$"The DbContext type '{GetShortTypeName(contextTypeName)}' has already been registered for EF migrations on resource '{builder.Resource.Name}'.");
$"The DbContext type '{GetShortTypeName(dbContextTypeName)}' has already been registered for EF migrations on resource '{builder.Resource.Name}'.");
}

if (existingMigrations.Any(r => r.ContextTypeName == null))
if (existingMigrations.Any(r => r.DbContextTypeName == null))
{
throw new InvalidOperationException(
$"Cannot add migrations for a specific DbContext type when auto-detected migrations have already been registered on resource '{builder.Resource.Name}'.");
Expand All @@ -163,7 +164,7 @@ private static IResourceBuilder<EFMigrationResource> AddEFMigrationsCore(
}
}

var migrationResource = new EFMigrationResource(name, builder.Resource, contextTypeName)
var migrationResource = new EFMigrationResource(name, builder.Resource, dbContextTypeName)
{
ConfigureToolResource = configureToolResource
};
Expand All @@ -180,7 +181,7 @@ private static IResourceBuilder<EFMigrationResource> AddEFMigrationsCore(
.WithIconName("Database")
.WithPipelineStepFactory(CreateMigrationPipelineStep);

AddEFMigrationCommands(innerBuilder, migrationResource, contextTypeName);
AddEFMigrationCommands(innerBuilder, migrationResource, dbContextTypeName);

return innerBuilder;
}
Expand Down Expand Up @@ -270,7 +271,7 @@ private static async Task ExecutePublishPipelineOperationAsync(
using var executor = new EFCoreOperationExecutor(
migrationResource.ProjectResource,
migrationResource.MigrationsProjectPath,
migrationResource.ContextTypeName,
migrationResource.DbContextTypeName,
logger,
stepContext.CancellationToken,
stepContext.Services,
Expand Down Expand Up @@ -520,9 +521,9 @@ await notificationService.PublishUpdateAsync(toolResource, s => s with
private static void AddEFMigrationCommands(
IResourceBuilder<EFMigrationResource> migrationBuilder,
EFMigrationResource migrationResource,
string? contextTypeName)
string? dbContextTypeName)
{
var contextShortName = GetShortTypeName(contextTypeName);
var contextShortName = GetShortTypeName(dbContextTypeName);

// Create hidden DotnetToolResource for running EF commands
var toolName = $"ef-tool-{migrationResource.Name}";
Expand Down Expand Up @@ -718,7 +719,7 @@ private static async Task<ExecuteCommandResult> ExecuteWithStateManagementAsync(
using var executor = new EFCoreOperationExecutor(
migrationResource.ProjectResource,
migrationResource.MigrationsProjectPath,
migrationResource.ContextTypeName,
migrationResource.DbContextTypeName,
logger,
context.CancellationToken,
context.ServiceProvider,
Expand Down
Loading
Loading