EF Core Invalid Column Name (Foreign Keys)What is “.NET Core”?EF multiple foreign key relationship on same primary keyEntity Framework throws invalid column name User_Id errorEntity Framework - Invalid column name 'CourseLesson_Id'Getting data through entity model Relational tables in ASP.NET WEB APIEntity Framework Invalid column name on Navigation Property foreign keyWhat is the difference between .NET Core and .NET Standard Class Library project types?Build .NET Core console application to output an EXE?ForeignKey to the same table with custom column nameEF Core: override naming conventions

How quickly could a country build a tall concrete wall around a city?

Can we tile the board by L trominos?

Dropdowns & Chevrons for Right to Left languages

Pretty heat maps

How do Mogwai reproduce?

What is the idiomatic way of saying “he is ticklish under armpits”?

What are good ways to improve as a writer other than writing courses?

Write an interpreter for *

sed delete all the words before a match

Can a one way NS Ticket be used as an OV-Chipkaart for P+R Parking in Amsterdam?

Why did Gandalf use a sword against the Balrog?

Are any jet engines used in combat aircraft water cooled?

How can I iterate this process?

Does the United States guarantee any unique freedoms?

Why couldn't soldiers sight their own weapons without officers' orders?

Blocking people from taking pictures of me with smartphone

I was asked to prove the Principle of Cauchy Induction

Was this a rapid SCHEDULED disassembly? How was it done?

How can a surrogate pass on genes to a fertilized embryo?

Is refreshing multiple times a test case for web applications?

Is this cheap "air conditioner" able to cool a room?

Is there a loss of quality when converting RGB to HEX?

Shabbat clothing on shabbat chazon

How many different ways are there to checkmate in the early game?



EF Core Invalid Column Name (Foreign Keys)


What is “.NET Core”?EF multiple foreign key relationship on same primary keyEntity Framework throws invalid column name User_Id errorEntity Framework - Invalid column name 'CourseLesson_Id'Getting data through entity model Relational tables in ASP.NET WEB APIEntity Framework Invalid column name on Navigation Property foreign keyWhat is the difference between .NET Core and .NET Standard Class Library project types?Build .NET Core console application to output an EXE?ForeignKey to the same table with custom column nameEF Core: override naming conventions






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








0















I'm using EF Core 2.2
the Code with the error



var ClientCase= _context.Client_Cases.Include(a=>a.Case_Sessions). FirstOrDefault(x => x.Id == id);


The Error




System.Data.SqlClient.SqlException: 'Invalid column name
'Client_CaseId'. Invalid column name 'Case_LevelId'. Invalid column
name 'Client_CaseId'. Invalid column name 'Court_CircleId'. Invalid
column name 'Court_HallId'.'




Entities



1- Parent Client_Case



public class Client_Cases

[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id get; set;
public string Opponent get; set;
public DateTime? StartDate get; set;
public DateTime Recieve_Date get; set;
[ForeignKey("Clients")]
public long? ClientID get;set;
public Clients Client get; set;
[ForeignKey("Case_Levels")]
public long? LevelID get; set;
public virtual Case_Levels Case_Levels get; set;
[ForeignKey("Case_Types")]
public long? TypeID get; set;
public virtual Case_Types Case_Types get; set;
[ForeignKey("Court_Circles")]
public long? CircleID get; set;
public virtual Court_Circles Court_Circles get; set;
[ForeignKey("Court_Halls")]
public long? HallID get; set;
public virtual Court_Halls Court_Halls get; set;
[ForeignKey("Courts")]
public long? CourtID get; set;
public virtual Courts Court get; set;
[ForeignKey("Case_Status")]
public long? StatusID get; set;
public Case_Status Case_Status get; set;
[ForeignKey("Lawyers")]
public long? LawyerID get; set;
public virtual LawyersData Lawyers get; set;
public string Description get; set;
public string Code get; set;
public string CaseNo get; set;
public List<Case_Sessions> Case_Sessions get; set;



Detail Entity Case_Session



public class Case_Sessions

[Key]
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public long Id get; set;
[ForeignKey("Client_Cases")]
public long? CaseID get;set;
public Client_Cases Client_Case get; set;
[ForeignKey("Case_Levels")]
public long? LevelID get; set;
public Case_Levels Case_Level get; set;
[ForeignKey("Court_Circles")]
public long? CircleID get; set;
public Court_Circles Court_Circle get; set;
[ForeignKey("Court_Halls")]
public long? HallID get; set;
public Court_Halls Court_Hall get; set;
[ForeignKey("Case_Status")]
public long? StatusID get; set;
public Case_Status Case_Status get; set;
public DateTime Session_Date get; set;
public string Judge_Name get; set;
public string Session_Result get; set;
public string Notes get; set;



if I get the parent without include the child it works
if I get the detail it works



I know the error that EF Core Create its own naming convention for the Foreign keys
but I think the tag Foreign Key override that naming convention



Now where I am wrong?



Thank You










share|improve this question
































    0















    I'm using EF Core 2.2
    the Code with the error



    var ClientCase= _context.Client_Cases.Include(a=>a.Case_Sessions). FirstOrDefault(x => x.Id == id);


    The Error




    System.Data.SqlClient.SqlException: 'Invalid column name
    'Client_CaseId'. Invalid column name 'Case_LevelId'. Invalid column
    name 'Client_CaseId'. Invalid column name 'Court_CircleId'. Invalid
    column name 'Court_HallId'.'




    Entities



    1- Parent Client_Case



    public class Client_Cases

    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public long Id get; set;
    public string Opponent get; set;
    public DateTime? StartDate get; set;
    public DateTime Recieve_Date get; set;
    [ForeignKey("Clients")]
    public long? ClientID get;set;
    public Clients Client get; set;
    [ForeignKey("Case_Levels")]
    public long? LevelID get; set;
    public virtual Case_Levels Case_Levels get; set;
    [ForeignKey("Case_Types")]
    public long? TypeID get; set;
    public virtual Case_Types Case_Types get; set;
    [ForeignKey("Court_Circles")]
    public long? CircleID get; set;
    public virtual Court_Circles Court_Circles get; set;
    [ForeignKey("Court_Halls")]
    public long? HallID get; set;
    public virtual Court_Halls Court_Halls get; set;
    [ForeignKey("Courts")]
    public long? CourtID get; set;
    public virtual Courts Court get; set;
    [ForeignKey("Case_Status")]
    public long? StatusID get; set;
    public Case_Status Case_Status get; set;
    [ForeignKey("Lawyers")]
    public long? LawyerID get; set;
    public virtual LawyersData Lawyers get; set;
    public string Description get; set;
    public string Code get; set;
    public string CaseNo get; set;
    public List<Case_Sessions> Case_Sessions get; set;



    Detail Entity Case_Session



    public class Case_Sessions

    [Key]
    [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
    public long Id get; set;
    [ForeignKey("Client_Cases")]
    public long? CaseID get;set;
    public Client_Cases Client_Case get; set;
    [ForeignKey("Case_Levels")]
    public long? LevelID get; set;
    public Case_Levels Case_Level get; set;
    [ForeignKey("Court_Circles")]
    public long? CircleID get; set;
    public Court_Circles Court_Circle get; set;
    [ForeignKey("Court_Halls")]
    public long? HallID get; set;
    public Court_Halls Court_Hall get; set;
    [ForeignKey("Case_Status")]
    public long? StatusID get; set;
    public Case_Status Case_Status get; set;
    public DateTime Session_Date get; set;
    public string Judge_Name get; set;
    public string Session_Result get; set;
    public string Notes get; set;



    if I get the parent without include the child it works
    if I get the detail it works



    I know the error that EF Core Create its own naming convention for the Foreign keys
    but I think the tag Foreign Key override that naming convention



    Now where I am wrong?



    Thank You










    share|improve this question




























      0












      0








      0








      I'm using EF Core 2.2
      the Code with the error



      var ClientCase= _context.Client_Cases.Include(a=>a.Case_Sessions). FirstOrDefault(x => x.Id == id);


      The Error




      System.Data.SqlClient.SqlException: 'Invalid column name
      'Client_CaseId'. Invalid column name 'Case_LevelId'. Invalid column
      name 'Client_CaseId'. Invalid column name 'Court_CircleId'. Invalid
      column name 'Court_HallId'.'




      Entities



      1- Parent Client_Case



      public class Client_Cases

      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long Id get; set;
      public string Opponent get; set;
      public DateTime? StartDate get; set;
      public DateTime Recieve_Date get; set;
      [ForeignKey("Clients")]
      public long? ClientID get;set;
      public Clients Client get; set;
      [ForeignKey("Case_Levels")]
      public long? LevelID get; set;
      public virtual Case_Levels Case_Levels get; set;
      [ForeignKey("Case_Types")]
      public long? TypeID get; set;
      public virtual Case_Types Case_Types get; set;
      [ForeignKey("Court_Circles")]
      public long? CircleID get; set;
      public virtual Court_Circles Court_Circles get; set;
      [ForeignKey("Court_Halls")]
      public long? HallID get; set;
      public virtual Court_Halls Court_Halls get; set;
      [ForeignKey("Courts")]
      public long? CourtID get; set;
      public virtual Courts Court get; set;
      [ForeignKey("Case_Status")]
      public long? StatusID get; set;
      public Case_Status Case_Status get; set;
      [ForeignKey("Lawyers")]
      public long? LawyerID get; set;
      public virtual LawyersData Lawyers get; set;
      public string Description get; set;
      public string Code get; set;
      public string CaseNo get; set;
      public List<Case_Sessions> Case_Sessions get; set;



      Detail Entity Case_Session



      public class Case_Sessions

      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long Id get; set;
      [ForeignKey("Client_Cases")]
      public long? CaseID get;set;
      public Client_Cases Client_Case get; set;
      [ForeignKey("Case_Levels")]
      public long? LevelID get; set;
      public Case_Levels Case_Level get; set;
      [ForeignKey("Court_Circles")]
      public long? CircleID get; set;
      public Court_Circles Court_Circle get; set;
      [ForeignKey("Court_Halls")]
      public long? HallID get; set;
      public Court_Halls Court_Hall get; set;
      [ForeignKey("Case_Status")]
      public long? StatusID get; set;
      public Case_Status Case_Status get; set;
      public DateTime Session_Date get; set;
      public string Judge_Name get; set;
      public string Session_Result get; set;
      public string Notes get; set;



      if I get the parent without include the child it works
      if I get the detail it works



      I know the error that EF Core Create its own naming convention for the Foreign keys
      but I think the tag Foreign Key override that naming convention



      Now where I am wrong?



      Thank You










      share|improve this question
















      I'm using EF Core 2.2
      the Code with the error



      var ClientCase= _context.Client_Cases.Include(a=>a.Case_Sessions). FirstOrDefault(x => x.Id == id);


      The Error




      System.Data.SqlClient.SqlException: 'Invalid column name
      'Client_CaseId'. Invalid column name 'Case_LevelId'. Invalid column
      name 'Client_CaseId'. Invalid column name 'Court_CircleId'. Invalid
      column name 'Court_HallId'.'




      Entities



      1- Parent Client_Case



      public class Client_Cases

      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long Id get; set;
      public string Opponent get; set;
      public DateTime? StartDate get; set;
      public DateTime Recieve_Date get; set;
      [ForeignKey("Clients")]
      public long? ClientID get;set;
      public Clients Client get; set;
      [ForeignKey("Case_Levels")]
      public long? LevelID get; set;
      public virtual Case_Levels Case_Levels get; set;
      [ForeignKey("Case_Types")]
      public long? TypeID get; set;
      public virtual Case_Types Case_Types get; set;
      [ForeignKey("Court_Circles")]
      public long? CircleID get; set;
      public virtual Court_Circles Court_Circles get; set;
      [ForeignKey("Court_Halls")]
      public long? HallID get; set;
      public virtual Court_Halls Court_Halls get; set;
      [ForeignKey("Courts")]
      public long? CourtID get; set;
      public virtual Courts Court get; set;
      [ForeignKey("Case_Status")]
      public long? StatusID get; set;
      public Case_Status Case_Status get; set;
      [ForeignKey("Lawyers")]
      public long? LawyerID get; set;
      public virtual LawyersData Lawyers get; set;
      public string Description get; set;
      public string Code get; set;
      public string CaseNo get; set;
      public List<Case_Sessions> Case_Sessions get; set;



      Detail Entity Case_Session



      public class Case_Sessions

      [Key]
      [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
      public long Id get; set;
      [ForeignKey("Client_Cases")]
      public long? CaseID get;set;
      public Client_Cases Client_Case get; set;
      [ForeignKey("Case_Levels")]
      public long? LevelID get; set;
      public Case_Levels Case_Level get; set;
      [ForeignKey("Court_Circles")]
      public long? CircleID get; set;
      public Court_Circles Court_Circle get; set;
      [ForeignKey("Court_Halls")]
      public long? HallID get; set;
      public Court_Halls Court_Hall get; set;
      [ForeignKey("Case_Status")]
      public long? StatusID get; set;
      public Case_Status Case_Status get; set;
      public DateTime Session_Date get; set;
      public string Judge_Name get; set;
      public string Session_Result get; set;
      public string Notes get; set;



      if I get the parent without include the child it works
      if I get the detail it works



      I know the error that EF Core Create its own naming convention for the Foreign keys
      but I think the tag Foreign Key override that naming convention



      Now where I am wrong?



      Thank You







      c# .net-core core ef-core-2.2






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 27 at 9:13









      fhnaseer

      4,08111 gold badges45 silver badges93 bronze badges




      4,08111 gold badges45 silver badges93 bronze badges










      asked Mar 27 at 7:45









      Maher KhalilMaher Khalil

      1523 silver badges16 bronze badges




      1523 silver badges16 bronze badges

























          1 Answer
          1






          active

          oldest

          votes


















          2














          [ForeignKey("")] Mean? name the property you have added in class to become a foreign key. e.g:



          public long? CaseID get;set;
          [ForeignKey("CaseID")]
          public Client_Cases Client_Case get; set;

          public long? CircleID get; set;
          [ForeignKey("CircleID")]
          public Court_Circles Court_Circle get; set;


          You can use annotations like above, In your case, below correction needed:



          [ForeignKey("Client")] // it should be [ForeignKey("Client")] not an extra s if you using entities name in annotation.
          public long? ClientID get;set;
          public Clients Client get; set;


          this should be your relationship for lawyer:



          [ForeignKey("Lawyers")]
          public long? LawyersID get; set;
          public virtual LawyersData Lawyers get; set;


          I am assuming that the type of primary key in LawyersData table is long?.






          share|improve this answer



























          • you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

            – Maher Khalil
            Mar 27 at 8:23











          • yes, name for the column, but they can take entity name too.

            – Nomi Ali
            Mar 27 at 8:24












          • entityframeworktutorial.net/code-first/… check this link.

            – Nomi Ali
            Mar 27 at 8:26











          • Now i'm confused in the begining you are writing the column name then you are writing the table name

            – Maher Khalil
            Mar 27 at 8:40











          • Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

            – Nomi Ali
            Mar 27 at 8:45










          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%2f55372103%2fef-core-invalid-column-name-foreign-keys%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









          2














          [ForeignKey("")] Mean? name the property you have added in class to become a foreign key. e.g:



          public long? CaseID get;set;
          [ForeignKey("CaseID")]
          public Client_Cases Client_Case get; set;

          public long? CircleID get; set;
          [ForeignKey("CircleID")]
          public Court_Circles Court_Circle get; set;


          You can use annotations like above, In your case, below correction needed:



          [ForeignKey("Client")] // it should be [ForeignKey("Client")] not an extra s if you using entities name in annotation.
          public long? ClientID get;set;
          public Clients Client get; set;


          this should be your relationship for lawyer:



          [ForeignKey("Lawyers")]
          public long? LawyersID get; set;
          public virtual LawyersData Lawyers get; set;


          I am assuming that the type of primary key in LawyersData table is long?.






          share|improve this answer



























          • you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

            – Maher Khalil
            Mar 27 at 8:23











          • yes, name for the column, but they can take entity name too.

            – Nomi Ali
            Mar 27 at 8:24












          • entityframeworktutorial.net/code-first/… check this link.

            – Nomi Ali
            Mar 27 at 8:26











          • Now i'm confused in the begining you are writing the column name then you are writing the table name

            – Maher Khalil
            Mar 27 at 8:40











          • Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

            – Nomi Ali
            Mar 27 at 8:45















          2














          [ForeignKey("")] Mean? name the property you have added in class to become a foreign key. e.g:



          public long? CaseID get;set;
          [ForeignKey("CaseID")]
          public Client_Cases Client_Case get; set;

          public long? CircleID get; set;
          [ForeignKey("CircleID")]
          public Court_Circles Court_Circle get; set;


          You can use annotations like above, In your case, below correction needed:



          [ForeignKey("Client")] // it should be [ForeignKey("Client")] not an extra s if you using entities name in annotation.
          public long? ClientID get;set;
          public Clients Client get; set;


          this should be your relationship for lawyer:



          [ForeignKey("Lawyers")]
          public long? LawyersID get; set;
          public virtual LawyersData Lawyers get; set;


          I am assuming that the type of primary key in LawyersData table is long?.






          share|improve this answer



























          • you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

            – Maher Khalil
            Mar 27 at 8:23











          • yes, name for the column, but they can take entity name too.

            – Nomi Ali
            Mar 27 at 8:24












          • entityframeworktutorial.net/code-first/… check this link.

            – Nomi Ali
            Mar 27 at 8:26











          • Now i'm confused in the begining you are writing the column name then you are writing the table name

            – Maher Khalil
            Mar 27 at 8:40











          • Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

            – Nomi Ali
            Mar 27 at 8:45













          2












          2








          2







          [ForeignKey("")] Mean? name the property you have added in class to become a foreign key. e.g:



          public long? CaseID get;set;
          [ForeignKey("CaseID")]
          public Client_Cases Client_Case get; set;

          public long? CircleID get; set;
          [ForeignKey("CircleID")]
          public Court_Circles Court_Circle get; set;


          You can use annotations like above, In your case, below correction needed:



          [ForeignKey("Client")] // it should be [ForeignKey("Client")] not an extra s if you using entities name in annotation.
          public long? ClientID get;set;
          public Clients Client get; set;


          this should be your relationship for lawyer:



          [ForeignKey("Lawyers")]
          public long? LawyersID get; set;
          public virtual LawyersData Lawyers get; set;


          I am assuming that the type of primary key in LawyersData table is long?.






          share|improve this answer















          [ForeignKey("")] Mean? name the property you have added in class to become a foreign key. e.g:



          public long? CaseID get;set;
          [ForeignKey("CaseID")]
          public Client_Cases Client_Case get; set;

          public long? CircleID get; set;
          [ForeignKey("CircleID")]
          public Court_Circles Court_Circle get; set;


          You can use annotations like above, In your case, below correction needed:



          [ForeignKey("Client")] // it should be [ForeignKey("Client")] not an extra s if you using entities name in annotation.
          public long? ClientID get;set;
          public Clients Client get; set;


          this should be your relationship for lawyer:



          [ForeignKey("Lawyers")]
          public long? LawyersID get; set;
          public virtual LawyersData Lawyers get; set;


          I am assuming that the type of primary key in LawyersData table is long?.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 27 at 10:46

























          answered Mar 27 at 8:08









          Nomi AliNomi Ali

          1,0153 gold badges21 silver badges41 bronze badges




          1,0153 gold badges21 silver badges41 bronze badges















          • you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

            – Maher Khalil
            Mar 27 at 8:23











          • yes, name for the column, but they can take entity name too.

            – Nomi Ali
            Mar 27 at 8:24












          • entityframeworktutorial.net/code-first/… check this link.

            – Nomi Ali
            Mar 27 at 8:26











          • Now i'm confused in the begining you are writing the column name then you are writing the table name

            – Maher Khalil
            Mar 27 at 8:40











          • Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

            – Nomi Ali
            Mar 27 at 8:45

















          • you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

            – Maher Khalil
            Mar 27 at 8:23











          • yes, name for the column, but they can take entity name too.

            – Nomi Ali
            Mar 27 at 8:24












          • entityframeworktutorial.net/code-first/… check this link.

            – Nomi Ali
            Mar 27 at 8:26











          • Now i'm confused in the begining you are writing the column name then you are writing the table name

            – Maher Khalil
            Mar 27 at 8:40











          • Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

            – Nomi Ali
            Mar 27 at 8:45
















          you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

          – Maher Khalil
          Mar 27 at 8:23





          you mean [ForeignKey("Case_Status")] take the name for the column not the name of the table ?? but i'm putting the name of the table in the data annotation and it is working on other places

          – Maher Khalil
          Mar 27 at 8:23













          yes, name for the column, but they can take entity name too.

          – Nomi Ali
          Mar 27 at 8:24






          yes, name for the column, but they can take entity name too.

          – Nomi Ali
          Mar 27 at 8:24














          entityframeworktutorial.net/code-first/… check this link.

          – Nomi Ali
          Mar 27 at 8:26





          entityframeworktutorial.net/code-first/… check this link.

          – Nomi Ali
          Mar 27 at 8:26













          Now i'm confused in the begining you are writing the column name then you are writing the table name

          – Maher Khalil
          Mar 27 at 8:40





          Now i'm confused in the begining you are writing the column name then you are writing the table name

          – Maher Khalil
          Mar 27 at 8:40













          Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

          – Nomi Ali
          Mar 27 at 8:45





          Both works, The way you did is slightly wrong. You use like: [ForeignKey("Clients")], it should be Client not clients. so correct one is: [ForeignKey("Client")]

          – Nomi Ali
          Mar 27 at 8:45








          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.







          Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.



















          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%2f55372103%2fef-core-invalid-column-name-foreign-keys%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

          Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현