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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T23:03:26+00:00 2026-06-11T23:03:26+00:00

Bear with me as I’m new to C# and programming in general. I’m trying

  • 0

Bear with me as I’m new to C# and programming in general.

I’m trying to define a complex type that is in the same table as the principle class. Basically, it’s the good old User and Address example.

public class Customer
{
    [Key]
    public int customerId { get; set; }

    //some attributes

    public string street { get; set; }
    public string city { get; set; }
    public string province { get; set; }
    public string country { get; set; }
    public string postal { get; set; }
}

So I try to slice off the address information into its own class:

public class Customer
{
    [Key]
    public int customerId { get; set; }

    //some attributes
    public Address address { get; set; }
}

[ComplexType]
public class Address
{
    public string street { get; set; }
    public string city { get; set; }
    public string province { get; set; }
    public string country { get; set; }
    public string postal { get; set; }
}

I get no compile error and when I load a view that access the Customer model, I get an unknown column in field set error.

Unknown column ‘Extent1.address_street’ in ‘field list’

I basically followed this example: http://weblogs.asp.net/manavi/archive/2010/12/11/entity-association-mapping-with-code-first-part-1-one-to-one-associations.aspx

Is there something I”m missing or something different with EF5?

  • 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-11T23:03:27+00:00Added an answer on June 11, 2026 at 11:03 pm

    By default EF expects columns for properties of complex types in form {complextypename_propertyname}. If you created your tables manually and named columns differently there will be a mismatch. Can you try renaming the columns accordingly (i.e. street to address_street) and try if it works. Alternatively you should be able to add an attribute to the properties on the complex type to tell EF that is should not use the convention but the name you specified (e.g. [Column(“street”)] for the street property).

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

Sidebar

Related Questions

Please bear with me as I am new to dojo, javascript, and web programming
Please bear in mind that I'm totally new to Rails when answering this.My question
Bear with me because I'm new to WPF/XAML. I'm trying to write a MainWindow.xaml
Please bear with me -- I know this is complex. I have a table
I am new to programming to kindly bear me. I using c sharp, .net
Please bear with me as I am very new to functional programming and Haskell.
Bear with me, as I'm quite new to using regular expressions. I have regexp
please bear with my newbie questions.. I was trying to convert PDF to PNG
Bear with me, this one's not very easy to explain... I'm trying to configure
Bear with me as I am new to obj-c but I have a UIScrollView

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.