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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T11:30:17+00:00 2026-05-27T11:30:17+00:00

In our database, we have the following tables Tags Id (int) Name (string) IsActive

  • 0

In our database, we have the following tables

Tags
  Id (int)
  Name (string)
  IsActive (bool)
  TagType (string)

and

DocumentStyles
  Id (int)
  Name (string)
  StyleRules (string)
  IsAvailable (bool)
  ThumbnailFileId (int nullable)
  ConceptTagId (int nullable)

With the EF 4.2 designer, I’ve created the appropriate entities, and am trying to link the foreign key of ConceptTagId to the Tag model.

When I add the association (0..1 to many from Tag to DocumentStyle), it correctly links the foreign key and adds the navigation property of ConceptTag to the DocumentStyle object. I do not want a navigation property on the Tag object.

However, when calling the following code in a repository

db.DocumentStyles.Include(d => d.ConceptTag).ToList();

the resulting query attempts to access a property DocumentStyle_ID on the Tag table, which does not exist, nor should it. The foreign key is the ConceptTagId on the DocumentStyle table.

Where does this id column come from, and how can I get rid of it?

From the properties window of the relevant association:

End1 Multiplicity: * of DocumentStyle
End1 Nav Property: ConceptTag
End2 Multiplicity: Zero of One of Tag
End2 Nav Property: {NULL} (its blank in the property)

  • 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-27T11:30:18+00:00Added an answer on May 27, 2026 at 11:30 am

    Under further investigation, it comes with breaking the convention of naming styles. To resolve the issue, I had to implement in the OnModelCreating event the following rule

    builder.Entity<DocumentStyle>().HasOptional(ds => ds.ConceptTag).WithMany(); 
    

    This allows the framework to know that Tag has no reciprocal property to expect in the relationship and it doesnt attempt to find the DocumentStyle_Id property in future queries

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

Sidebar

Related Questions

We've encountered the following situation in our database. We have table 'A' and table
I have 100000 Ids to store into our DataBase. Id is in string format.each
Tables have been created in our SQL Server 2008 R2 database on a local server,
I have the following set of tables in an existing database. Resource - ResourceID
I have a table in the database with the following columns: ID, Name, Txt
I have the following database structure (which can't be changed): Users - UserID (int)
Our database server is a SQL 2008 server. My colleagues all have XP service
We have scalar functions in our database for returning things like number of tasks
We are moving our database server to a bigger box. I have several databases
We have a whole bunch of DLLs that give us access to our database

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.