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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:23:00+00:00 2026-05-27T17:23:00+00:00

I know I can solve this by pushing everything into a single entity rather

  • 0

I know I can solve this by pushing everything into a single entity rather than nesting complex types (as they are just 1-1 mappings), but I like the way it groups properties in the generated OM.

I have a Customer entity that contains a complext type “CrmData”. The CrmData entity has a complex type of address.

public class Customer {
  [Required]
  public CrmSpecificData CrmData { get; set; }
}
[ComplexType]
public class CrmSpecificData {
  [MaxLength(40)]
  public string FirstName { get; set; }

  [MaxLength(80)]
  public string LastName { get; set; }

  public Address Address { get; set; }
}
[ComplexType]
public class Address {
  [MaxLength(150)]
  public string Address1 { get; set; }

  [MaxLength(150)]
  public string Address2 { get; set; }

  [MaxLength(100)]
  public string City { get; set; }

  [MaxLength(15)]
  public string PostalCode { get; set; }

  public StateProvince StateOrProvince { get; set; }

  public virtual CountryRegion CountryOrRegion { get; set; }
}

The StateProvince & CountryRegion types are entities in my DB (similar to how the AdventureWorks sample DB works). The problem is that when EF tries to create the model, it fails with:

The type ‘MyCo.Crm.Entities.StateProvince’ has already been configured as an entity type. It cannot be reconfigured as a complex type..

I’ve tried making the StateProvince a complex type but that doesn’t resolve the issue. Ideas?

public class StateProvince {
  [Key]
  public int StateProvinceId { get; set; }

  [MaxLength(3)]
  public string StateProvinceCode { get; set; }

  [MaxLength(50)]
  public string Name { get; set; }
}
  • 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-27T17:23:00+00:00Added an answer on May 27, 2026 at 5:23 pm

    Complex types cannot contain navigation properties. Navigation properties can be defined only in entity. So you must either:

    • Use table splitting instead of complex types but it would result in another problems – for example you will not be able to nest those types and you will have to use eager / lazy loading to load them.
    • Move all navigation properties to the main entity
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would know how can I solve this issue when I try to commit
I know I've solved this problem before, but I can't remember or find the
This is something I know can be done somehow , because I've done it
I know I can do most of this by hacking Trac and using Git
I need some ideas on how I can best solve this problem. I have
I have a query that I know can be done using a subselect, but
You can know if the event stack is empty calling the gtk.events_pending() method, but
I know you can look at the row.count or tables.count, but are there other
I know you can do redirection based on the domain or path to rewrite
I know I can programatically make the taskbar item for a particular window start

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.