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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:50:23+00:00 2026-06-15T09:50:23+00:00

I am new to Entity Framework but im trying to model my code after

  • 0

I am new to Entity Framework but im trying to model my code after some examples I have found online. I thought I had it set up the way I wanted but the Query that is created is pointing to the the wrong, non-existant table. I am wondering where it got the table name because it is wrong and I am not seeing any where in any of the project files that this wrong table name was specified. Here is the query that was generated and I got from debugging:

{SELECT 
[Extent1].[AssetTag] AS [AssetTag], 
[Extent1].[Location] AS [Location], 
[Extent1].[PoolType] AS [PoolType], 
[Extent1].[InventoryStatus] AS [InventoryStatus], 
[Extent1].[InventoryType] AS [InventoryType], 
[Extent1].[Comments] AS [Comments]
FROM [dbo].[ComputerInventories] AS [Extent1]}

ComputerInventories should be ComputerInventory.

Here is my data model

public class ComputerInventory
    {
        [Key]
        public String AssetTag {get; set;}
        public String Location { get; set; }
        public String PoolType { get; set; }
        //public String ReasonInProgram { get; set; }
        public String InventoryStatus { get; set; }
        public String InventoryType { get; set; }
        [StringLength(500)]
        public String Comments { get; set; }
        //public String Clock { get; set; }
    }

    public class AssetDBContext : DbContext
    {
        public DbSet<ComputerInventory> ComputerInventory { get; set; }

        public AssetDBContext()
            : base("Name=<name>")
        {
        }
    }

Here here is where the I am trying to get the list from the query

public ViewResult Index()
        {
            return View(db.ComputerInventory.ToList());
        }

I am completely lost as to where it is getting the ComputerInventories value for the table name.

  • 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-15T09:50:24+00:00Added an answer on June 15, 2026 at 9:50 am

    Entity Framework uses naming conventions for many things. One of them is that table names are created by taking the plural of the entity name. You can remove that convention like this:

    protected override void OnModelCreating(DbModelBuilder modelBuilder)
    {    
        modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
    }
    

    See PluralizalingTableNameConvention on MSDN.

    For more information on conventions

    http://entityframework.codeplex.com/wikipage?title=Custom%20Conventions

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

Sidebar

Related Questions

In this code, I have an Entity Framework 4 model with a single Thing
Im new to Entity framework 5 and Im trying the enum support but Im
I'm new to Entity Framework and am trying to figure things out. I have
I'm new to Entity Framework and am trying to learn how to use Code
I'm trying out Entity Framework Code first CTP4. Suppose I have: public class Parent
When adding a new Entity Framework object to a database, how could one have
I'm new to Entity Framework and am using Database First. I have inherited a
I have created a new application using Entity Framework 4.3 database migrations. The migrations
I have an ASP.NET application using an entity framework model. In an import routine,
I've enabled code-first migrations on my entity framework project, and have added several migrations

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.