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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:30:07+00:00 2026-06-05T14:30:07+00:00

I have a database-first model generated with full primary keys. Database first model works

  • 0

I have a database-first model generated with full primary keys. Database first model works fine. However now I have upgraded my Entity Framework 4.3. I have modified the standard T4 template that comes with EF.

Now when I use Add-Migration initial to the project it is complaining that my entities do not have the Primary keys defined. Which is not true (or to some extent)… looking deeper I have composite keys for which EF expects me to define [Key, Column(0)] on all of the key elements.

System.Data.Entity.Edm.EdmEntitySet: EntityType: EntitySet 'SupplierWarehouses' is based on type 'SupplierWarehouses' that has no keys defined.

The problem I am facing is I trying to modify the WriteProperty method of T4 Template (DbContext) and there seems to be no Entity Key Property on System.Data.Metadata.Edm.EdmProperty object. Now this property is shown from Visual Studio Model Editor so Theory is it should exist.

Appreciate if some one could help me with this

Sanj.

  • 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-05T14:30:09+00:00Added an answer on June 5, 2026 at 2:30 pm

    I figured it out System.Data.Metadata.Edm.EdmProperty does not have it this property, it needs to be referred from System.Data.Metadata.Edm.EntityType the actual property is KeyMembers.

    I made the change to T4 WriteProperty to accept Entity Object now it works as beauty.

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

Sidebar

Related Questions

I'm new to Entity Framework and am using Database First. I have inherited a
I have an issue in entity framework code first, three table in database as
I have an Entity Framework 4 model-first design. I create a first draft of
I'm using Entity Framework to access my MySQL database. The model was generated using
Now that I have built a database. Visual Studio 2008 SP1’s ADO.NET Entity Framework
I have an established SQL Server database setup. I then generated an Entity Framework
In my application I'm using Entity Framework 4.0 Model First. I have several tables
I have a database framework where I have two tables. The first table has
I've got an application with a working Entity model generated from an existing database.
I've inherited a project which uses Entity Framework Database First. I'm trying to work

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.