Search code examples
entity-framework-6entity-framework-5upgrade

TrackableCollection could not be found after upgrading to EF6


I'm trying to upgrade from Entity Framework 5 to Entity Framework 6 but I've encountered a strange error when refreshing my generators (.tt's).

Error CS0246
The type or namespace name 'TrackableCollection<>' could not be found (are you missing a using directive or an assembly reference?)

The error is in in a partial class and is not auto generated.

I've deleted and then added the files again through the wizard, right-clicking the EDMX designer GUI thingy.

Why am I missing the TrackableCollection? I can't find much about it on Google, not even an MSDN page about it and no namespace!


Solution

  • HashSet is the new TrackableCollection in EF6.

    Initialize your collections with this instead or refactors your code so that you don't have to.