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

1928 у кіно

Захаров Федір Захарович

Ель Греко