Entity framework designer “Type ‘ObjectParameter is not defined” with old code generation items
31-Jul-1414 1 Comment
Errors:
- “Namespace or type specified in the imports ‘System.Data.Objects’ doesn’t contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure that the imported element name doesn’t use any aliases.”
- “Type ‘ObjectParameter is not defined” with old code generation items
The code generation item was created some years ago. Now whenever the myModel.context.tt is executed it puts “Imports System.Data.Objects” at the top of the Model.Context.vb file.
Solution
It provides a suggestion of “Change ‘System.Data.Objects’ to ‘System.Data.Entity.Core.Objects’ which is easy enough to do, only you will have to do it next time as well.
So do the change then actually copy the “Imports System.Data.Entity.Core.Objects”
into the Model.Context.tt file, so that next time it will generate correctly.
End.