Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Entity Framework 5 POCOs not included in TFS?

I'm working on project where we recently upgraded to Entity Framework 5. After we upgraded I created a new .edmx model and moved all out entities over to the new model.

From what I can tell Entity Framework 5 runs of POCO objects. The problem I'm having is that POCO objects don't seem to be included in source control. If a new developer opens the solution it doesn't include any generated POCO objects. To get around this we can right click "MyModel.Context.tt" and "MyModel.tt" and click "run custom tool" to generate the POCO objects. So is there a way to include the POCO objects in tfs so we don't have to generate them when a new dev opens the solution?

UPDATE

So I tried what a few people have suggested and use "include in project" but if I look at the the folder that contains the model in visual studio with the show all files options on none of the classes show up. BUT if I look at the folder with windows explorer it shows all the files... what give?

like image 413
NullReference Avatar asked Sep 14 '12 16:09

NullReference


3 Answers

Further to Saml's Answer above...

For Visual Studio 2012, in order to add your POCO's do the following;

  1. Open the Team Explorer Window using View>Team Explorer
  2. You will see a list of shortcuts... My Work, Pending Changes and so on;
  3. Under "Pending Changes" is a link to "Source Control Explorer"
  4. Click this link, to open the Source Control Explorer Window
  5. Navigate through your solution to the Project containing your edmx file
  6. Above the "Source Location" will be a toolbar
  7. The fourth icon from the left is "Add Items To Folder"
  8. Clicking this icon will bring up the "Add to Source Control" Dialog, showing all the files in this project which aren't currently under Source Control.
  9. Select all the files you wish to now include under Source Control
  10. Press Next, then Finish

Now Check In your Solution again, and your POCO's should now be included.

like image 196
PGallagher Avatar answered Nov 06 '22 09:11

PGallagher


First open the Team Explorer window:

  • View
  • Team Explorer

Then expand your project and double click "Source Control".

In the Source Control Explorer window, browse to the folder that the POCO files should be located in, right click the explorer window or directory and select "Add Items to Folder" (or something similar... it's been a few months since I've used TFS)

Finally select the files that were auto generated and include them. Don't forget to check in!

Something to note, when including auto generated files into TFS it is possible to have issues in the future if you ever try to re-generate those files. You may end up with ReadOnly access issues. This can be solved by manually checking out the files to unlock them. Once checked out, re-generate to your heart's content!

like image 41
saml Avatar answered Nov 06 '22 10:11

saml


This is a little late, but I just ran into the same problem.

I could not add the missing files to TFS. Instead of trying to add each file, I was able to right click on the EDMX file in the Solution Explorer then click 'run custom tool', then right click the EDMX file again and click Add To Source Control. This added all the missing files and I was able to check them in.

like image 4
Bart Avatar answered Nov 06 '22 10:11

Bart