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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T12:48:07+00:00 2026-05-13T12:48:07+00:00

I have two tables in my database – Category and Department which both contain

  • 0

I have two tables in my database – Category and Department which both contain the same columns – ID, Name and Code.

I can create a new entity model using the Visual Studio 2008 designer and add the Department and it works fine – I can query the database using LINQ, alls good.

When I update the model and add the Category table, the generated code throws the following errors when I try and compile.

The type 'DBContexts.Category' already contains a definition for 'ID'
The type 'DBContexts.Category' already contains a definition for '_ID'

The type 'DBContexts.Category' already contains a definition for 'Name'
The type 'DBContexts.Category' already contains a definition for '_Name'

A partial method may not have multiple defining declarations

I guess this is something to do with the fact that Department and Category have identical column names – but it doesn’t seam to have a problem with the Code column.

Any ideas how I can fix this? I can’t really go messing around with the generated code as any changes will be removed if I update the model.

Cheers

  • 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-13T12:48:07+00:00Added an answer on May 13, 2026 at 12:48 pm

    When you update the .dbml file the .designer.cs file is also regenerated BUT if this file is not accessible a new file is generated and added to the project. Since the classes in both files are partial but have the same properties and fields on compile you will get this error.

    You can check if you have only one designer generated file for your context. You can do that by right clicking on the name of your class and selecting “Go To Definition” – it will show all files containing definition of your class.

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

Sidebar

Related Questions

I have two tables in the database Team:Id(int PK), Name(nvarchar) and Player:Id(int PK), Name(nvarchar),
I have two different databases that contain two tables with the exact same design.
I use c#, linq and EF4. I have two tables in my DataBase represented
I have two database tables with a one-to-many relationship. Is it possible to select
I have two tables with columns of my interests as Table1.Column1 and Table2.Column2 Table1
So my situation is this. I have two tables, e.g. employee and department. When
I have two tables: projects and user_licenses . I'd like to grab the entire
I have two tables that are supposed to be related. Tables and Coloums Specification
So my situation is this. I have two tables. A main table where data
I think I've stumbled upon a bug in the .NET (or the native windows

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.