44using Microsoft . Extensions . DependencyInjection . Extensions ;
55using CommunityToolkit . Aspire . Hosting . SqlDatabaseProjects ;
66using Microsoft . SqlServer . Dac ;
7+ using System . Reflection ;
78
89namespace Aspire . Hosting ;
910
@@ -36,7 +37,7 @@ public static IResourceBuilder<SqlProjectResource> AddSqlProject<TProject>(this
3637 ArgumentNullException . ThrowIfNull ( builder , nameof ( builder ) ) ;
3738 ArgumentNullException . ThrowIfNull ( name , nameof ( name ) ) ;
3839
39- return builder . AddSqlProject ( name )
40+ return builder . AddSqlProject ( name , Assembly . GetCallingAssembly ( ) )
4041 . WithAnnotation ( new TProject ( ) ) ;
4142 }
4243
@@ -51,7 +52,22 @@ public static IResourceBuilder<SqlProjectResource> AddSqlProject(this IDistribut
5152 ArgumentNullException . ThrowIfNull ( builder , nameof ( builder ) ) ;
5253 ArgumentNullException . ThrowIfNull ( name , nameof ( name ) ) ;
5354
54- var resource = new SqlProjectResource ( name ) ;
55+ return builder . AddSqlProject ( name , Assembly . GetCallingAssembly ( ) ) ;
56+ }
57+
58+ /// <summary>
59+ /// Adds a SQL Server Database Project resource to the application.
60+ /// </summary>
61+ /// <param name="builder">An <see cref="IDistributedApplicationBuilder"/> instance to add the SQL Server Database project to.</param>
62+ /// <param name="name">Name of the resource.</param>
63+ /// <param name="appHostAssembly">The app host assembly to determine the build configuration</param>
64+ /// <returns>An <see cref="IResourceBuilder{T}"/> that can be used to further customize the resource.</returns>
65+ internal static IResourceBuilder < SqlProjectResource > AddSqlProject ( this IDistributedApplicationBuilder builder , [ ResourceName ] string name , Assembly appHostAssembly )
66+ {
67+ ArgumentNullException . ThrowIfNull ( builder , nameof ( builder ) ) ;
68+ ArgumentNullException . ThrowIfNull ( name , nameof ( name ) ) ;
69+
70+ var resource = new SqlProjectResource ( name , appHostAssembly ) ;
5571
5672 return builder . AddResource ( resource )
5773 . WithInitialState ( new CustomResourceSnapshot
0 commit comments