aspnet / vsweb-publish

Web publish support for ASP.NET 5 in Visual Studio 2015
Other
33 stars 22 forks source link

Make it simpler to add database to publish profile after the fact #35

Closed bdelaney closed 8 years ago

bdelaney commented 8 years ago

This has always confounded me since the first time I started publishing web apps to Azure 3 yrs ago. I think there is a way to add database publishing to the publish.xml later, but it just seems too difficult to add a database after you make choices in the initial dialog for Azure publishing when you create a new project. I guess you could say this about auth too.

But for me it seems obvious. We start a project and only later realize we have to use a database. Since I'm talking SQL Server here, and EF, I think it would be in Microsoft's best interest to make this a slam-dunk.

Correct me if I'm wrong, but I do not believe this can be accomplished just with EF migrations. Is there another way tucked away in some dark corner of Visual Studio that I'm not finding?

sayedihashimi commented 8 years ago

@bdelaney thanks for the note. Is your question for ASP.NET 5 (dnx/MVC 6) or is it for ASP.NET 4 (MVC 5) projects?

bdelaney commented 8 years ago

It is for ASP.NET 5. I'm still trying to track down where I would place a configuration or connection statement that might light up the db option in Publish. I admit I have not poured over all the EF7 docs yet. Here is the publish dialog I'm trying to reach but not clear about what I need to do in my EF enabled ASP.NET 5 web app project to get this to appear. I already have the EF references in, configure it in startup.cs, etc. image

bdelaney commented 8 years ago

I've tried a few manipulations and investigations of the existing RC1-update1 templates for web apps. By using the identity module I think I see how to run a migration against the Azure database set up with the web app. But it is all very mysterious. Like where is the secondary 'remote' connection string? How come the web app does not have a 'linked resource?' And of course, why is there zero information about database config in the publish .pubxml file. From what I can tell it comes down to 2 pieces of information set during the creation of the web app when it has Identity (individual user accounts) turned on. The connection string is set up with the web app on Azure. And the startup.cs gets a migration command if running in release mode. If this is all there is to it, then I'm surprised I could not find this anywhere. Not in 'readthedocs' and not in Github. I combed both resources intently, screening both aspnet and EF docs/issues. Unless I completely overlooked something, I think the ASPNET/EF teams could publish this more obviously.

bdelaney commented 8 years ago

Successful by doing the two things I mentioned above. Added connection string in Azure web app and ran the migration from within startup.cs. Even got my seed data populated.

sayedihashimi commented 8 years ago

@bdelaney for ASP.NET 5 we have not yet enabled EF migrations on the publish dialog. It is on our backlog. We are hoping to get to it in the next release but I cannot commit to that yet. For ASP.NET 4 we should already have the features you're looking for. If not please let me know.

bdelaney commented 8 years ago

I'm happy with my workaround in ASP.NET 5 Thanks for all your hard work. When the publishing tasks come together, they will be the icing on the cake that makes ASP.NET 5 the 'happy path' from concept to implementation. I know it must seem like an overwhelming task with all the churn that the web and EF teams are going through.