none
Add new table to the EMDX file RRS feed

  • Question

  • Hi I have an existing edmx file. I have added a new table to the database. To update the emdx file I used the "Update from database" in the edmx file. But this is not showing the newly added table from the database. I am uanble to add the new table to emdx file.
    • Edited by ChetanGunjikar Tuesday, August 23, 2011 12:33 PM Spelling mistake
    Tuesday, August 23, 2011 12:30 PM

Answers

  • Well,

    Then it seems like your App.config file in your EDMX project is not pointing to the right database...


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    • Proposed as answer by JA Reyes Wednesday, August 24, 2011 6:07 AM
    • Marked as answer by ChetanGunjikar Thursday, September 15, 2011 6:34 AM
    Tuesday, August 23, 2011 2:45 PM
  • Hi JA,

    Thanks a lot for pointing that I changed the connection string in the App.config file of my EDMX  project. Now  I am able to see the newly added table in "Update Wizard".

    Thanks alot once again.

     

    Thanks,

    Chetan

    Tuesday, August 23, 2011 2:53 PM

All replies

  • On 8/23/2011 8:30 AM, ChetanGunjikar wrote:
    > Hi I have an existing edmx file. I have added a new table to the
    > database. To update the emdx file I used the "Update from database" in
    > the edmx file. But this is not showing the newly added table from the
    > database. I am uanble to add the new table to emdx file.
     
    What are you saying here? Are you saying you added a new table to the
    Model in the VS IDE, told it to update the Model and it didn't add the
    new table to the Model?
     
    Tuesday, August 23, 2011 12:46 PM
  • Hi,

    If you created the new table while you had Visual Studio opened, try to close VS and open it again and refresh so the connection to the database.

    Otherwise, check that all connection parameters have not been changed at App.Config file and they point to the right database.

    Regards,

    JA Reyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    Tuesday, August 23, 2011 12:49 PM
  • On 8/23/2011 8:30 AM, ChetanGunjikar wrote:
    > Hi I have an existing edmx file. I have added a new table to the
    > database. To update the emdx file I used the "Update from database" in
    > the edmx file. But this is not showing the newly added table from the
    > database. I am uanble to add the new table to emdx file.
     
    Oh one other thing here. Did you add this table previously, deleted it,
    and you are trying to add the table again?
     
    Tuesday, August 23, 2011 12:57 PM
  • I have added a new table into the database. And then I am trying to add that new table to the existing edmx file by the "Update Wizard" . But in this I am not able to find the newly added table which I can add and update the edmx file. This is a new table added to the databse.

     

    Tuesday, August 23, 2011 1:42 PM
  • Hi JA ,

    I tried closing the VS and then again opening ,I have also checked the database connection  parameters and they are pointing to the correct database. But it still not showing the table into the "Update wizard".

     

     


    Tuesday, August 23, 2011 1:46 PM
  • Hi again,

     

    Has you new table a primary key?

     

    Regards,

    JA Reyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    Tuesday, August 23, 2011 2:17 PM
  • Hi JA,

     

    When the table first created that time the table was not having the primary key but later I created one Identity Column and set that as the primary key. But after that also table is not showing in the Update wizard.

     

    Tuesday, August 23, 2011 2:22 PM
  • Hi JA,

    When the table has been created it was not having the primary key. Later I altered the table and one Identity column and made that column as the primary key. But after that also the table is not showing up in the "Update wizard" in the VS.

     

    Thanks,

    Chetan

    Tuesday, August 23, 2011 2:25 PM
  • Hi,

    And it doesn't appear under the Refresh tab?


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    Tuesday, August 23, 2011 2:32 PM
  • Hi JA,

    It is not appearing in the "Refresh" tab also. For testing again I created a new table now with the primary key but this also not showing up in the "Update wizard".

    Tuesday, August 23, 2011 2:41 PM
  • Well,

    Then it seems like your App.config file in your EDMX project is not pointing to the right database...


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    • Proposed as answer by JA Reyes Wednesday, August 24, 2011 6:07 AM
    • Marked as answer by ChetanGunjikar Thursday, September 15, 2011 6:34 AM
    Tuesday, August 23, 2011 2:45 PM
  • Hi JA,

    Thanks a lot for pointing that I changed the connection string in the App.config file of my EDMX  project. Now  I am able to see the newly added table in "Update Wizard".

    Thanks alot once again.

     

    Thanks,

    Chetan

    Tuesday, August 23, 2011 2:53 PM
  • On 8/23/2011 10:22 AM, ChetanGunjikar wrote:
    > Hi JA,
    >
    > When the table first created that time the table was not having the
    > primary key but later I created one Identity Column and set that as the
    > primary key. But after that also table is not showing in the Update wizard.
    >
     
    Well, if EF already sees that table in the edmx because it was there
    previously, then EF can't handle it. This is particularly true if you
    have added a table, you go back and delete the table off the model, and
    then you try to add the table again to the model. EF is not going to
    show the table as a table that can be added again, because reminiscence
    of the table are still in the edmx after you have deleted off the model.
     
    In this situation, I always go to the edmx file and delete any traces of
    the table in question manually.
     
    By doing the deletion of the table entries in the model, EF knows what
    to do and adds the table back successfully. I suspect this may be the
    condition on update of the model based updating the table too, and then
    you try to update the model to reflect changes in the table.
     
    Therefore, you may want to delete the table out of the edmx all traces
    of it in the edmx so that you can go add the table as a new table on the
    model to see if EF will correct itself. This is one of the behaviors of
    EF. It has a mind of its own no matter what you are telling it to do.
     
    Tuesday, August 23, 2011 2:57 PM
  • Thanks for reply. Next time I will keep that in mind.

    Thanks a lot.

    Tuesday, August 23, 2011 3:04 PM
  • Hi,

    I'm glad this resolved your problem. But please, in order to help other users with the same problem, mark as answered the concrete reply that solve your issue.

    Best regards,

    JA Reyes.


    Please remember to Vote & "Mark As Answer" if this post is helpful to you.
    Por favor, recuerda Votar y "Marcar como respuesta" si la solución de esta pregunta te ha sido útil.
    Wednesday, August 24, 2011 12:51 PM