0

I'm trying to generate an entity from my SQL database using the ADO.NET Entity Data Model using the ADO.NET DbContext Generator. When I generate my edmx from the database I can see it in the model. I right click on my tt file (which is in a separate project) and run the custom tool. The entity appears. It's called CustomerContact. However, my dbcontext does not have a CustomerContacts collection. What is going on here?

Vojtěch Dohnal
  • 7,867
  • 3
  • 43
  • 105
  • Does the tool support your version of Entity framework? I have used PowerTools https://visualstudiogallery.msdn.microsoft.com/72a60b14-1581-4b9b-89f2-846072eff19d for Code Second in EF6 with no big problem. The tool you mentioned supports EF5. – Vojtěch Dohnal May 04 '16 at 07:22
  • Not sure where to look for this. I'm looking at Manage Nuget packages and I see I'm using EF 6.1.3 in my EDMX project and EF 6.1.3 in my tt project, but when I look in the projects' references they both say 6.0.0.0. Will this cause a problem? – The Mean Fiddler May 04 '16 at 07:58
  • I guess it may because this tool you have used is rather old and the latest support is for EF 5 on their webpage. – Vojtěch Dohnal May 04 '16 at 08:04
  • OK I may not be using this version of the context generator. How do I find out which version it is? – The Mean Fiddler May 04 '16 at 08:18
  • I suppose you have installed it from here? https://visualstudiogallery.msdn.microsoft.com/32c4660d-7e66-4c3a-b516-584f4f72b838 – Vojtěch Dohnal May 04 '16 at 08:19
  • I can't remember. Where is it in the solution explorer? – The Mean Fiddler May 04 '16 at 08:22
  • It is not in the Solution Explorer, it is a VS project type, as you wrote `ADO.NET Entity Data Model using the ADO.NET DbContext Generator`, ... Check this link http://stackoverflow.com/questions/22791170/purpose-of-ef-6-x-dbcontext-generator – Vojtěch Dohnal May 04 '16 at 08:36
  • Great thanks for your help. I can figure it out now – The Mean Fiddler May 04 '16 at 08:45

1 Answers1

0

I figured it out. The problem was the different versions of Entity Framework. I updated both projects to the latest version of EF and it works now