Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8238647
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T19:53:02+00:00 2026-06-07T19:53:02+00:00

I have an azure web application, running MVC 4. It uses the entity framework

  • 0

I have an azure web application, running MVC 4. It uses the entity framework (version 4.3.1.0) and Code First together with a data context.

I have the data context in its own project, that also have all the model files.

public class AwesomeModelContext : DbContext
{

    public DbSet<User> Users { get; set; }
    public DbSet<License> Licenses { get; set; }
    public DbSet<AppSession> AppSessions { get; set; }
    public DbSet<EditSession> EditSessions { get; set; }
    public DbSet<Space> Spaces { get; set; }
    public DbSet<SpaceUserPrivilege> SpaceUserPrivileges { get; set; }
    public DbSet<File> Files { get; set; }
    public DbSet<Resource> Resources { get; set; }
    public DbSet<Team> Teams { get; set; }

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {

        // Remove cascading deletes, having them turned on by default scares me.
        modelBuilder.Conventions.Remove<OneToManyCascadeDeleteConvention>();

        modelBuilder.Entity<Space>()
            .HasMany<SpaceUserPrivilege>(s => s.SpaceUserPrivileges)
            .WithRequired(p => p.Space)
            .WillCascadeOnDelete(true);
        modelBuilder.Entity<User>()
            .HasMany<SpaceUserPrivilege>(u => u.SpaceUserPrivileges)
            .WithRequired(p => p.User)
            .WillCascadeOnDelete(true);
        modelBuilder.Entity<Team>()
            .HasMany<User>(u => u.Users)
            .WithRequired()
            .WillCascadeOnDelete(false);
        // Run migrations, if any.
        Database.SetInitializer<AwesomeModelContext >(new MigrateDatabaseToLatestVersion<AwesomeModelContext , Configuration>());
    }

}

The relevant model is "Team" and it looks like this:

namespace MyAwesomeNamespace.Model
{
    public class Team
    {

        [Key]
        public int Id { get; set; }
        public string Name { get; set; }

        public ICollection<User> Users { get; private set; }

    }
}

That should all nice and well. These are the models for my entire web app. So now I want to add controllers so that I actually can do something with the models. So I do what I usally do,

Right-click the controller folder, and press "add controller"

I name the controller "TeamController", then select the model to be "MyAwesomeNamespace.Model.Team" and the data context to "MyAwesomeNamespace.Model.AwesomeModelContext".

I now press Add. This results in the following message.

"Unable to retrieve metadata for ‘MyAwesomeNamespace.Model.Team’. Invalid column name ‘CreatedOn’."

Anyone know what to do here? I can not find any solutions to this.


Some extra info:

Using Azure database (online).
Using Visual Studio 2010 Pro.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T19:53:04+00:00Added an answer on June 7, 2026 at 7:53 pm

    I would like to know whether you have a CreatedOn column in the Team table in your database. If you already have a database, please make sure your model class corresponds to the database table. For example, add the CreatedOn property to your model. If you want a code first approach, you can remove the database. Let Entity Framework automatically generate the database. You can also take the database first approach. Let the Entity Framework automatically generated the code from the database.

    Best Regards,

    Ming Xu.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Currently I'm trying to port a web application(ASP.NET MVC) to windows azure and have
I'm running a Windows Azure web application (ASP.Net MVC). How do I measure the
I have an MVC web app running in azure that serves up large files
I have deployed an ASP.NET web application to Azure running in a web role.
I have a web application running on Windows Azure. It is built with ASP.Net
We have a Web Role that we are hosting in Windows Azure that uses
I have a Web application which will be deployed to Windows Azure and I'm
Azure web role (MVC 3 project) wont' start with Twilio controller class I have
I have one web application and virtual application in Azure. They are separate projects
I have a site running on an Azure web role and I can force

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.