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 7563555
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:41:42+00:00 2026-05-30T13:41:42+00:00

I am trying to build a database with multiple tables in MVC. I built

  • 0

I am trying to build a database with multiple tables in MVC.
I built a model.cs with the table attributes and let Entity Framework do its thing.
Now I want to create a new table in the same database and link them.

I have tried “creating new table” in the database where my previous table exists. This hands out a type-mismatch exception, invalid key exception, etc…

I also tried adding a new class within the model and tying it to the context…that doesn’t help either…

code looks SOMETHING like this….


namespace bleh.bleh
{
    public partial class T1
    {
        //.....attributes primary key
    }

    public class T2
    {
        //...attributes foreign key to T1
    }

    public class TEntity : DbContext
    {
        public DbSet<T1> Tab1....
        public DbSet<T2> Tab2....
    }
}

Please advise…

  • 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-05-30T13:41:43+00:00Added an answer on May 30, 2026 at 1:41 pm

    Here’s the solution I found: add the following line in the StartApplication method of the global.asax file:

    Database.SetInitializer<FTContext>(new DropCreateDatabaseIfModelChanges<FTContext>());
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Exuberant Ctags 5.7. I am trying to build a tag database
I'm trying to build out a mysql database design for a project. The problem
I'm trying to build a Hibernate layer for a database schema I have essentially
I'm trying to build a search for our internal support database - each support
I'm trying to write an MSBuild task to build a database using FluentNhibernate mappings.
As part of our build process and evolving database, I'm trying to create a
I'm developing an iPhone app that uses the built-in SQLite database. I'm trying to
I'm trying to connect to an Oracle 10g database using the built in Microsoft
I'm trying to build a query for a medical database that counts the number
I am trying to build a CMS I can use to host multiple sites.

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.