ASP.net MVC project on Azure but old versions of properties and no data

Dean Everhart 1,496 Reputation points
2021-09-11T13:50:33.077+00:00

I have a ASP.net MVC project deployed to Azure.

Website works and links in navigation bar navigate to MVC CRUD views in the url but there is no data.

Microsoft SQL Server Management Studio shows database structure with no data. on Azure. The columns / properties include past versions of properties from all the previous code-based migrations...so the properties / columns, though present on Azure, are not up-to-date.

I think my next step is to use drop create database when model changes or always to get current database properties and data up to Azure. I'm not exactly sure how to write the code for this. below is first unsuccessful attempt in context file.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
// end default
// using System.Data.Linq;     CreateDatabase
// using System.Data;          CreateDatabase
// using System.Data.Object;   CreateDatabase
using alpha.Models;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;

namespace alpha.Data
{
    public class alphaContext : DbContext
    {
        public alphaContext() : base("alphaContext") // The name of the connection string is passed in to the constructor.
        {
            // Database.SetInitializer<alphaContext>(new CreateDatabaseAlways<alphaContext>());
        }
        public DbSet<item> items { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
        }
    }
}

My notes including screen captures in a pdf

ASP.NET
ASP.NET
A set of technologies in the .NET Framework for building web applications and XML web services.
3,374 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Dean Everhart 1,496 Reputation points
    2021-09-14T01:33:33.287+00:00

    Answer: Re: DropCreateDatabaseAlways

    DropCreateDatabaseAlways updated the data schema anew, but did not upload data (which is what, I've learned, it's suppose to do). So, strictly speaking, DropCreateDatabaseAlways, did not solve the problem of getting existing local data to Azure

    0 comments No comments