Invalid object name using code first Entity Framework on database table The Next CEO of Stack OverflowEntity Framework Code First naming conventions - back to plural table names?Entity Framework added s to my .dbo“The Controls collection cannot be modified because the control contains code blocks”Validation failed for one or more entities while saving changes to SQL Server Database using Entity FrameworkCode-first vs Model/Database-firstIgnoring a class property in Entity Framework 4.1 Code FirstEntity Framework code first Fluent mappingInvalid object name 'dbo.Infoes' when retrieving data from DB using EFEntity Framework 5 Updating a RecordCode-first in Entity Framework columns doesn't exists migrationInvalid column name (Entity Framework)What is wrong, System.Data.SqlClient.SqlException: Invalid column name 'tbl_rules_rulID'.?

How to safely derail a train during transit?

How do we know the LHC results are robust?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

What's the point of interval inversion?

What makes a siege story/plot interesting?

Can the Reverse Gravity spell affect the Meteor Swarm spell?

Implement the Thanos sorting algorithm

MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs

What is meant by a M next to a roman numeral?

How can I open an app using Terminal?

If I blow insulation everywhere in my attic except the door trap, will heat escape through it?

Why does GHC infer a monomorphic type here, even with MonomorphismRestriction disabled?

Was a professor correct to chastise me for writing "Prof. X" rather than "Professor X"?

Why were Madagascar and New Zealand discovered so late?

Why does standard notation not preserve intervals (visually)

What do "high sea" and "carry" mean in this sentence?

% symbol leads to superlong (forever?) compilations

How do I construct this japanese bowl?

Can a single photon have an energy density?

How can I get through very long and very dry, but also very useful technical documents when learning a new tool?

Only print output after finding pattern

Horror movie/show or scene where a horse creature opens its mouth really wide and devours a man in a stables

If the heap is initialized for security, then why is the stack uninitialized?

Science fiction (dystopian) short story set after WWIII



Invalid object name using code first Entity Framework on database table



The Next CEO of Stack OverflowEntity Framework Code First naming conventions - back to plural table names?Entity Framework added s to my .dbo“The Controls collection cannot be modified because the control contains code blocks”Validation failed for one or more entities while saving changes to SQL Server Database using Entity FrameworkCode-first vs Model/Database-firstIgnoring a class property in Entity Framework 4.1 Code FirstEntity Framework code first Fluent mappingInvalid object name 'dbo.Infoes' when retrieving data from DB using EFEntity Framework 5 Updating a RecordCode-first in Entity Framework columns doesn't exists migrationInvalid column name (Entity Framework)What is wrong, System.Data.SqlClient.SqlException: Invalid column name 'tbl_rules_rulID'.?










0















I am using Entity Framework code-first migrations. And I created a migration to change the name of a table in my database:



public partial class ChangeNameOfCodePerformanceAnchorTable : DbMigration

public override void Up()

RenameTable(name: "dbo.Code_PerformanceAnchor", newName: "CodePerformanceAnchor");


public override void Down()

RenameTable(name: "dbo.CodePerformanceAnchors", newName: "Code_PerformanceAnchor");




Now, when I create the controller for that table.. on the Index action I have this:



public ActionResult Index()

return View(db.CodePerformanceAnchor.Include(c => c.CodePhase).ToList());



When I run the application to get to that specific index page, I get this error:




Invalid object name 'dbo.CodePerformanceAnchors'.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.CodePerformanceAnchors'.




The only thing in my application that is called CodePerformanceAnchors is the controller. The model is CodePerformanceAnchor.



public virtual DbSet<CodePerformanceAnchor> CodePerformanceAnchor get; set; 


Any help on resolving this error would be greatly appreciated.










share|improve this question
























  • Pluralization is the default. Check the actual name of the table in the database.

    – Steve Greene
    Mar 7 at 19:22















0















I am using Entity Framework code-first migrations. And I created a migration to change the name of a table in my database:



public partial class ChangeNameOfCodePerformanceAnchorTable : DbMigration

public override void Up()

RenameTable(name: "dbo.Code_PerformanceAnchor", newName: "CodePerformanceAnchor");


public override void Down()

RenameTable(name: "dbo.CodePerformanceAnchors", newName: "Code_PerformanceAnchor");




Now, when I create the controller for that table.. on the Index action I have this:



public ActionResult Index()

return View(db.CodePerformanceAnchor.Include(c => c.CodePhase).ToList());



When I run the application to get to that specific index page, I get this error:




Invalid object name 'dbo.CodePerformanceAnchors'.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.CodePerformanceAnchors'.




The only thing in my application that is called CodePerformanceAnchors is the controller. The model is CodePerformanceAnchor.



public virtual DbSet<CodePerformanceAnchor> CodePerformanceAnchor get; set; 


Any help on resolving this error would be greatly appreciated.










share|improve this question
























  • Pluralization is the default. Check the actual name of the table in the database.

    – Steve Greene
    Mar 7 at 19:22













0












0








0








I am using Entity Framework code-first migrations. And I created a migration to change the name of a table in my database:



public partial class ChangeNameOfCodePerformanceAnchorTable : DbMigration

public override void Up()

RenameTable(name: "dbo.Code_PerformanceAnchor", newName: "CodePerformanceAnchor");


public override void Down()

RenameTable(name: "dbo.CodePerformanceAnchors", newName: "Code_PerformanceAnchor");




Now, when I create the controller for that table.. on the Index action I have this:



public ActionResult Index()

return View(db.CodePerformanceAnchor.Include(c => c.CodePhase).ToList());



When I run the application to get to that specific index page, I get this error:




Invalid object name 'dbo.CodePerformanceAnchors'.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.CodePerformanceAnchors'.




The only thing in my application that is called CodePerformanceAnchors is the controller. The model is CodePerformanceAnchor.



public virtual DbSet<CodePerformanceAnchor> CodePerformanceAnchor get; set; 


Any help on resolving this error would be greatly appreciated.










share|improve this question
















I am using Entity Framework code-first migrations. And I created a migration to change the name of a table in my database:



public partial class ChangeNameOfCodePerformanceAnchorTable : DbMigration

public override void Up()

RenameTable(name: "dbo.Code_PerformanceAnchor", newName: "CodePerformanceAnchor");


public override void Down()

RenameTable(name: "dbo.CodePerformanceAnchors", newName: "Code_PerformanceAnchor");




Now, when I create the controller for that table.. on the Index action I have this:



public ActionResult Index()

return View(db.CodePerformanceAnchor.Include(c => c.CodePhase).ToList());



When I run the application to get to that specific index page, I get this error:




Invalid object name 'dbo.CodePerformanceAnchors'.



Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.



Exception Details: System.Data.SqlClient.SqlException: Invalid object name 'dbo.CodePerformanceAnchors'.




The only thing in my application that is called CodePerformanceAnchors is the controller. The model is CodePerformanceAnchor.



public virtual DbSet<CodePerformanceAnchor> CodePerformanceAnchor get; set; 


Any help on resolving this error would be greatly appreciated.







c# asp.net-mvc ef-code-first ef-migrations






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 7 at 14:47









marc_s

583k13011241270




583k13011241270










asked Mar 7 at 14:09









M12 BennettM12 Bennett

3,58711857




3,58711857












  • Pluralization is the default. Check the actual name of the table in the database.

    – Steve Greene
    Mar 7 at 19:22

















  • Pluralization is the default. Check the actual name of the table in the database.

    – Steve Greene
    Mar 7 at 19:22
















Pluralization is the default. Check the actual name of the table in the database.

– Steve Greene
Mar 7 at 19:22





Pluralization is the default. Check the actual name of the table in the database.

– Steve Greene
Mar 7 at 19:22












1 Answer
1






active

oldest

votes


















0














You have 2 names for table:



CodePerformanceAnchor


and


CodePerformanceAnchors (additional s at the end)



You can also check this (Pluggable Conventions) or this (specifying table name)






share|improve this answer

























  • Sorry, I'm confused.. how do I fix it?

    – M12 Bennett
    Mar 7 at 14:17











  • Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

    – Pablo notPicasso
    Mar 7 at 14:19











Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045791%2finvalid-object-name-using-code-first-entity-framework-on-database-table%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














You have 2 names for table:



CodePerformanceAnchor


and


CodePerformanceAnchors (additional s at the end)



You can also check this (Pluggable Conventions) or this (specifying table name)






share|improve this answer

























  • Sorry, I'm confused.. how do I fix it?

    – M12 Bennett
    Mar 7 at 14:17











  • Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

    – Pablo notPicasso
    Mar 7 at 14:19















0














You have 2 names for table:



CodePerformanceAnchor


and


CodePerformanceAnchors (additional s at the end)



You can also check this (Pluggable Conventions) or this (specifying table name)






share|improve this answer

























  • Sorry, I'm confused.. how do I fix it?

    – M12 Bennett
    Mar 7 at 14:17











  • Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

    – Pablo notPicasso
    Mar 7 at 14:19













0












0








0







You have 2 names for table:



CodePerformanceAnchor


and


CodePerformanceAnchors (additional s at the end)



You can also check this (Pluggable Conventions) or this (specifying table name)






share|improve this answer















You have 2 names for table:



CodePerformanceAnchor


and


CodePerformanceAnchors (additional s at the end)



You can also check this (Pluggable Conventions) or this (specifying table name)







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 7 at 14:28

























answered Mar 7 at 14:15









Pablo notPicassoPablo notPicasso

2,30331320




2,30331320












  • Sorry, I'm confused.. how do I fix it?

    – M12 Bennett
    Mar 7 at 14:17











  • Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

    – Pablo notPicasso
    Mar 7 at 14:19

















  • Sorry, I'm confused.. how do I fix it?

    – M12 Bennett
    Mar 7 at 14:17











  • Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

    – Pablo notPicasso
    Mar 7 at 14:19
















Sorry, I'm confused.. how do I fix it?

– M12 Bennett
Mar 7 at 14:17





Sorry, I'm confused.. how do I fix it?

– M12 Bennett
Mar 7 at 14:17













Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

– Pablo notPicasso
Mar 7 at 14:19





Have you changed ChangeNameOfCodePerformanceAnchorTable since creating it? Up method uses CodePerformanceAnchor why Down method uses CodePerformanceAnchors. Erorr seems to be thrown when Down is invoked.

– Pablo notPicasso
Mar 7 at 14:19



















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55045791%2finvalid-object-name-using-code-first-entity-framework-on-database-table%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved