Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility of SqlDatabaseProjects with Aspire.Hosting.Azure.Sql #434

Open
dgee2 opened this issue Jan 31, 2025 · 14 comments
Open

Compatibility of SqlDatabaseProjects with Aspire.Hosting.Azure.Sql #434

dgee2 opened this issue Jan 31, 2025 · 14 comments

Comments

@dgee2
Copy link

dgee2 commented Jan 31, 2025

Related to an existing integration?

Yes

Existing integration

SqlDatabaseProjects

Overview

You currently cannot pass a database created with AddAzureSqlServer as a reference when calling AddSqlProject.

The proposal is to add functionality so that there is the ability to deploy dacpac style projects to both SQL containers and Azure SQL.

Usage example

var builder = DistributedApplication.CreateBuilder(args);

builder.AddRedis("cache");

var sql = builder.AddAzureSqlServer("sql")
                 .AddDatabase("menu");

var menuDB = builder.AddSqlProject<Projects.MenuDB>("menuDB")
    .WithReference(sql);

Breaking change?

No

Alternatives

Potentially could be a separate package although adding to SqlDatabaseProjects is likely to be a smoother experience for consumers.

Additional context

No response

Help us help you

Yes, but only if others can assist

@Alirexaa
Copy link
Member

@ErikEJ @jmezach

@ErikEJ
Copy link
Contributor

ErikEJ commented Jan 31, 2025

I have just added the ability to use a connection string - but not sure what the purpose of AddAzureSqlServer is.

The SQL projects extension is local only, not for deployment manifest.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 1, 2025

I think it will work because of the added connection string support, as a AzureSqlServerResource implements IResourceWithConnectionString

@aaronpowell
Copy link
Member

I think that adding that package breaks even if you do a local container by doing:

builder.AddAzureSqlServer("sql").RunAsContainer();

I noticed something last week but I had to pivot off Azure to unblock and I haven't gotten back to investigating if it was the integration or my code.

@davidfowl
Copy link

What breaks?

@aaronpowell
Copy link
Member

the dbproject didn't get deployed

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 3, 2025

I assume because the extension extends only SqlServerResource and not AzureSqlServerResource?

@jmezach
Copy link
Contributor

jmezach commented Feb 3, 2025

Doesn't AzureSqlServerResource extend SqlServerResource?

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 3, 2025

@jmezach No, I think SqlServerResource is very much a container resource: https://learn.microsoft.com/en-us/dotnet/api/aspire.hosting.azure.azuresqlserverresource?view=dotnet-aspire-8.0

@davidfowl
Copy link

We haven't attempted to make this more abstract as yet.

@ErikEJ
Copy link
Contributor

ErikEJ commented Feb 3, 2025

@davidfowl @jmezach Guess we could just add more extension methods that accepts a AzureSqlServerResource and constrain on that in addition to SqlServerResource? If the ability to publish a .dacpac to an Azure SQL DB adds value? (I think it does)

Copy link

We have noticed this issue has not been updated within 21 days. If there is no action on this issue in the next 14 days, we will automatically close it. You can use /stale-extend to extend the window.

@github-actions github-actions bot added the Stale label Feb 25, 2025
@dgee2
Copy link
Author

dgee2 commented Feb 25, 2025

@davidfowl @jmezach I'm happy to take a look at implementing @ErikEJ suggestion of adding extension methods if it's agreed that that is the solution to move forward with

@ErikEJ
Copy link
Contributor

ErikEJ commented Mar 4, 2025

@dgee2 Feel free to create a PR, we now have another "customer report"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants