I've recently undertaken a new project using ASP.NET MVC and I'm not terribly familiar with the technology. I'm still in the very early stages and am just about to start teaching myself how to use Entity Framework to deal with my data access code. I'm just having a rather tough time making heads or tails of what software/tool/feature can do what, but I think I'm on the right track with EF.
I'm looking for something that is going to be able to see the differences in my local database to that in my production database (schema, not the actual data in it) and be able to publish that to a SQL Server in our local network. In my mind, I think of it like a DVCS for databases.
Traditionally (like most I'd say) I would write my own data access code using SQL in my code or stored procedures etc. and I'd deal with the database side of things myself. That is no longer an option for me though because I need to set up separate environments for development and production, and I don't really have the time nor desire to manually write all of that code any more. Dev will be local to the dev machine and production will be hosted on a server on our local network.
I've recently started using the "Publish" feature in Visual Studio and I have managed to set that up to work pretty well, publishing new versions to the directory which my IIS server is looking at to serve up the site.
I use Git and Sourcetree to deal with DVCS for my project code, however I've never personally used or found a solution to do something similar for databasing. At first I thought I was looking for some kind of DVCS for SQL Server, but that didn't return much. Essentially I just want some kind of tool that is going to manage version differences between local and production databases, and I think that is something EF can do for me.
For the databasing, I'm using SQL Server. I haven't set up a database yet for this project, so I'm thinking code-first EF would be the best approach. I want to ensure that EF is using a database in SQL Server though, which I believe I can set by specifying a connection string to use as opposed to one in Visual Studio. I need db access through SSMS occasionally so I can play with indexes and backup plans and such that I'd normally do through SSMS, but I'd still like EF to do the bulk of the work for me.
- Can I achieve my desired goals using Entity Framework the way I'm hoping? That is, having a tool that deals with database differences and updates between versions? I don't want to have to figure out what tables/columns etc. I've changed locally and have to somehow work that into the production database, but I also don't want the data in the production db to change, just the structure...
- I'd love for anyone to provide advice on how this setup should be constructed, or even links to a tutorial on how to set it up. I'm sure I'm not the first person to want to do this, and I know I wont be the last.
Essentially I'd just like to click the "Publish" button and have all local differences in both code AND database be published to the production server.