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

  • Home
  • SEARCH
  • 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 7756343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T12:47:52+00:00 2026-06-01T12:47:52+00:00

I am developing an asp.net mvc application, which has these enity classes: public class

  • 0

I am developing an asp.net mvc application, which has these enity classes:

public class Person
    {
        public int PersonID { get; set; }
        public string PersonPicAddress { get; set; }

        public virtual List<Person_Local> PersonLocal { get; set; }
}

public class Person_Local
{
    public int PersonID { get; set; }

    public int CultureID { get; set; }

    public string PersonName { get; set; }

    public string PersonFamily { get; set; }

    public string PersonAbout { get; set; }

    public virtual Culture Culture { get; set; }

    public virtual Person Person { get; set; }
}

public class Culture
{
    public int CultureID { get; set; }

    [Required()]
    public string CultureName { get; set; }

    [Required()]    
    public string CultureDisplay { get; set; }

    public virtual List<HomePage> HomePage { get; set; }

    public virtual List<Person_Local> PersonLocak { get; set; }
}

I defined an action with [Httppost] attribute, which accepts complex object from a view.

Here is the action :

[HttpPost]
public ActionResult CreatePerson([Bind(Prefix = "Person")]Person obj)
        {

      AppDbContext da = new AppDbContext();

      //Only getting first PersonLocal from list of PersonLocals
      obj.PersonLocal[0].Person = obj;

       da.Persons.Add(obj);

       da.SaveChanges();

       return Jsono(...);

}

But when it throws error as below :

Exception:Thrown: "Invalid column name 'Culture_CultureID'." (System.Data.SqlClient.SqlException)
A System.Data.SqlClient.SqlException was thrown: "Invalid column name 'Culture_CultureID'."

And the insert statement :

ADO.NET:Execute Reader "insert [dbo].[Person_Local]([PersonID], [PersonName], [PersonFamily], [PersonAbout], [Culture_CultureID])
values (@0, @1, @2, @3, null)
select [CultureID]
from [dbo].[Person_Local]
where @@ROWCOUNT > 0 and [CultureID] = scope_identity()"
The command text "insert [dbo].[Person_Local]([PersonID], [PersonName], [PersonFamily], [PersonAbout], [Culture_CultureID])
values (@0, @1, @2, @3, null)
select [CultureID]
from [dbo].[Person_Local]
where @@ROWCOUNT > 0 and [CultureID] = scope_identity()" was executed on connection "Data Source=bab-pc;Initial Catalog=MainDB;Integrated Security=True;Application Name=EntityFrameworkMUE", building a SqlDataReader.

Where is the problem?

Edited:

Included EntityConfigurations Code:

   public class CultureConfig : EntityTypeConfiguration<Culture>
    {
        public CultureConfig()
        {

            HasKey(x => x.CultureID);

            Property(x => x.CultureName);

            Property(x => x.CultureDisplay);

            ToTable("Culture");
        }
    }

    public class PersonConfig : EntityTypeConfiguration<Person>
    {
        public PersonConfig()
        {

            HasKey(x => x.PersonID);

            Property(x=>x.PersonPicAddress);

            ToTable("Person");
        }
    }

    public class Person_LocalConfig : EntityTypeConfiguration<Person_Local>
    {
        public Person_LocalConfig()
        {
            HasKey(x => x.PersonID);

            HasKey(x => x.CultureID);

            Property(x=>x.PersonName);

            Property(x => x.PersonFamily);

            Property(x => x.PersonAbout);

            ToTable("Person_Local");

          }

    }
  • 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-01T12:47:53+00:00Added an answer on June 1, 2026 at 12:47 pm

    Try to remove fields CultureID and PersonID from Person_Local class. Because you already has field Person and Culture

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

Sidebar

Related Questions

I'm developing an ASP.Net mvc application which has a requirement to do some small,
We are currently developing a web application in ASP.NET MVC which would really benefit
I am developing an asp.net mvc application in which I keep user credentials in
We are developing an ASP.NET MVC application, and are now building the repository/service classes.
I am developing an ASP.NET MVC application that has two kind of pages: (1)
I am developing an application which is web-based (asp.net MVC). The user configures reminders
I'm currently developing an asp.net mvc 2 application which uses the default SqlMembershipProvider for
I'm new to the jQuery and ASP.Net MVC. I'm developing a mvc application which
I'm developing an ASP.NET MVC 3 application and it uses a complex model which
I am developing an asp.net mvc application in which deliver some services to my

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.