DbContext
subclassup.sql
and down.sql
, both in App_Data
). An example will be found in the lecture repository. These should be included in your Git repository.something.mdf
and something_log.ldf
if using LocalDB) should not be tracked by Git. These files should be ignored and only generated and populated from the script when needed."As a student in CS 460 I want to build a database-backed web application using ASP.NET MVC 5 so I can learn how to create and use a local database for persistent storage in my web app. I also want to show how I can write T-SQL to create and populate a simple database in order to be ready for more complicated databases coming soon."
.gitignore
file so it will correctly ignore all the temporary build files as well as built binary files. Create a simple home landing page that will serve as the home page for this app. Put links here for pages you create later.Start with the data model: Design and create the database, which will have only a single table that uses an integer primary key. Use the scripts from the example in lecture to create the database and populate it with a few example entries. This means you'll have one script to create the table and populate it with at least 5 entries (up.sql
) and a separate script to clear it all away (down.sql
). Both of these need to be in your App_Data
folder and need to be in your Git repository.
You can create the database using SQL Server, SQL Server Express or LocalDB. The first two of these require a separate installation. LocalDB comes with Visual Studio, provided you installed the data storage and processing workload when installing VS, and can be accessed through the Server Explorer tab. For now the database is local to your machine. Anyone wanting to duplicate your project from your Git repository would have to manually create the database, run your up script on it and then edit the connection string.
Web.config
Create strongly typed views. Then write Razor code to create UI as you wish. You'll need a minimum of two pages: one to fill out and submit a new address change request and another page to view all requests (show them in a table). The look and feel of the site is up to you.
You should write the views yourself for maximum learning and understanding. Sure, take a look at some scaffolded code as examples but then write it yourself. Plus, the scaffolded views look pretty dismal.