Entity framework designer “Type ‘ObjectParameter is not defined” with old code generation items

Errors:

  1. “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.”
  2. “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.

 

Advertisements

One Response to Entity framework designer “Type ‘ObjectParameter is not defined” with old code generation items

  1. Tim Bessler says:

    Thanks for the tip! It didn’t occur to me to edit the TT file, as one of my junior developers had added stored procs, which caused the obsolete reference to be used for its parameters.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: