3

i am working on visual studio 2012, team project on TFS. after my team members updated database, i tried to get the latest updates on models, i update my models from database, my models is deleted, i tried to refresh tables from database, and get latest version from source control but my model are deleted i need your experience thank you

  • You need to explain a little more about what you are doing. Are you using SQL Server, MySQL, or other? Are you using the Entity framework? What do you have in source control? What changes did you colleague make? How are you "refreshing your models" from the databse? – MrHinsh - Martin Hinshelwood Apr 29 '15 at 06:16
  • Hello, we are using oracle client 11g to connect to oracle database, and entity framework 5, my team members generate models from database, my colleges add attributes to database and change criteria on attributes in database.and i have refreshed my models from database but the problem is the models are deleted from mu local copy of project and i couldn't get them by get lateset version of project. – Jaber Abdallatef May 02 '15 at 11:54
  • I'm using SQL server and having a similar problem. Did you ever find the cause? When I make database table changes, I remove the table(s) using the model browser. Next I update the model from the database. Everything seems fine on my end, but the table class is deleted from source control so my colleague cannot compile. This occurs only on my work, not his. I cannot figure out what I'm doing to cause this issue. – MsTapp Oct 24 '16 at 12:21

1 Answers1

0

Are sure you are using the same same permissions as other devs? Remember if your dev account does not have permission to a particular table in Oracle, then it will not be seen when using "Update model from database", and hence removed.

Also if you do have correct permissions, then when you select "Update model from database", if the entity/table is already imported into your data model, then you will be refreshing the entity. This process will not automatically map your database schema to your existing data model, you can however add a property to the entity in your EF model, and then map the property to the database column (this is exactly what EF does for you automatically when you delete and update normally). When you delete the entity first, then update EF knows that the table/entity has not been imported before and so will map all of the database columns automatically for you.

Carl Prothman
  • 1,461
  • 13
  • 23