none
Entity Framework 'Update Model From Database' not displaying new tables RRS feed

  • Question

  • We are using Entity Framework 4.1 inside VS2010 and Team Foundation 2010 version control. Schema first EF generation.  I add a EF Model to the project, adding some tables and commit the project.  My coworker updates the project and gets the edmx.  He can view the designer, but when he goes to 'Update Model from Database' to add anything it does not list any tables.  There are tables that are in the designer, and tables that are not.  These new tables do not show up to add.  In the Update Wizard there are no tables under 'Add', 'Refresh' or 'Delete'.  It seems like he is not connected to the database but he is.  He is using the same connection name in Server Explorer with the same username and password.  The u/p is also saved in the connection string in the App.Config.

    I am guessing we are missing some way to "rebind" to the database from a different computer?





    • Moved by CoolDadTx Tuesday, June 19, 2012 2:05 AM EF related (From:Visual C# IDE)
    • Edited by crossleyman Wednesday, June 20, 2012 4:06 PM clairify
    Monday, June 18, 2012 8:05 PM

All replies

  • Hi crossleyman,

    Welcome to MSDN Forum.

    Please check whether all the tables have already in the designer, if yes, the wizard will like below, no tables list there.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, June 19, 2012 5:37 AM
    Moderator
  • There are tables that are in the designer, and tables that are not.  In the Update Wizard there are no tables under 'Add', 'Refresh' or 'Delete'.  It seems like he is not connected to the database, but he is. I get the same thing when my connection times out, and I need to refresh the connection.


    • Edited by crossleyman Wednesday, June 20, 2012 4:04 PM
    Wednesday, June 20, 2012 3:57 PM
  • On 6/20/2012 11:57 AM, crossleyman wrote:
    > There are tables that are in the designer, and tables that are not. In
    > the Update Wizard there are no tables under 'Add', 'Refresh' or
    > 'Delete'. It seems like he is not connected to the database, but he is.
    > I get the same thing when my connection times out, and I need to refresh
    > the connection.
    >
    >
     
    If these tables are already in the EDMX file, then you are going to have
    to delete them out of the EDMX file, save the file and do a refresh in
    the designer to make them show.
     
    Wednesday, June 20, 2012 5:04 PM
  • Right. I understand that.  What my coworker wants to do, for instance, is add objects.  But it does not list the new objects.
    Wednesday, June 20, 2012 5:46 PM
  • On 6/20/2012 1:46 PM, crossleyman wrote:
    > Right. I understand that. What my coworker wants to do, for instance, is
    > add objects. But it does not list the new objects.
     
    If somehow those objects were on the model (a mistake or whatever),
    those objects were deleted off the model, you tried to put them back by
    pointing to the database and updating the model to include new tables,
    they may not show, because EF never deleted them out of the EDMX. The
    EDMX already sees the entries in the EDMX, and they are not going to
    show because EF thinks they are there.
     
    I have had it happen, and that's the only reason I can think of as to
    why those new tables will not show as a selection to be placed on the
    model. If those tables are in the EDMX already, then delete them out of
    the EDMX, and EF should pick them up again on the update of the model.
     
    Wednesday, June 20, 2012 7:12 PM
  • Thanks. But I can add and remove tables all day.  But if it is committed to Team and obtained via 'Get Latest' by my coworker, it acts like it nolonger connected to the database.  However he is connected to the database with the same u/p and the same connection name.  Schema name is the same... the whole setup is the same, but it is like the Designer doesn't recognize the database connection.
    Wednesday, June 20, 2012 9:14 PM
  • Hi crossleyman,

    The models still can be added by you, but your coworker couldn't? I suggest you to let your coworker to add a new same edmx file in his project, and try to find is there any settings different with the file downloaded from Team.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, June 21, 2012 8:08 AM
    Moderator
  • Hi crossleyman,

    Have you solved the issue? I look forward to hearing from you.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Tuesday, June 26, 2012 3:08 AM
    Moderator
  • hi Allen,

    There are no differences in the file downloaded from Team.  My coworker can create a new edmx file and all works fine.  I suspect that if he commits this to team, I would have the same problem with it as he does with mine.

    Tuesday, June 26, 2012 8:18 PM
  • I just checked with him again and it seems that he was forced to reboot his desktop and it is seeing the connection for the moment.  Tables show as expected in the wizard etc...  So it seems a little too much magic in it knowing what connection to use on the client.  Is there some way to pick the connection to use?  Shouldn't the wizard prompt?
    Tuesday, June 26, 2012 8:52 PM
  • Hi crossleyman,

    Please left click at anywhere of the designer, and then look at the Properties Window, the connection string is there. Please check whether that connection string can connect to the database.

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, June 27, 2012 6:25 AM
    Moderator
  • Hi,

    I have recently came accross this issue and have realised that If a table doesnt have Primary Key defined then the designer will not populate an entity for it. I hope that helps sort out this issue.

    thanks

    M Meydan


    • Edited by MMeydan Monday, November 12, 2012 9:50 PM
    • Proposed as answer by Kathiresan P Thursday, July 10, 2014 12:41 PM
    Monday, November 12, 2012 9:49 PM
  • yeh! thanks it works but if we dont want to insert primary key in the table then ? it is not allowing to add the table ? any other solution ?
    Monday, December 3, 2012 12:08 PM
  • I had similar problems.

    Look at the connection string for your "Data Connection" and for your EDMX file (which is stored in your web.config)

    We use Oracle and someone changed the web.config connection string to point to a tnsnames entry I do not have on my machine - so my machine couldn't connect using the "Model", but I was seeing the tables in the "Data Connection".

    Once I changed the web.config to point to the SAME tnsname - the Wizard can see the tables.

    Now we need to reconcile tnsnames for everyone on the project...

    Friday, July 26, 2013 5:10 PM