T4 to SQL . NET error

Asked

Viewed 55 times

1

When trying to generate sql code based on edmx you are showing this error

Severity Code Description Project File Line Suppression State Error Running Transformation: System.Nullreferenceexception: Object Reference not set to an instance of an Object. at

Microsoft.Data.Entity.Design.Databasegeneration.MetadataWorkspaceExtensions.Getallassociationsets(Itemcollection itemCollection) at

Microsoft.VisualStudio.TextTemplatingFED2D73CEED00C99E8A0A14FA9AE33EAFFDF3CAAFEE9E04D21CC913F1C5C88D960592C81A433C11663E61FD5459CF679CFD9B7275B72CA8BFB8D753DBB9FDDE3.GeneratedTextTransformation.TransformText() in C: Program Files (x86) Microsoft Visual Studio 14.0 Common7 IDE Extensions Microsoft Entity Framework Tools Dbgen Ssdltosql10.tt:line 104 Miscellaneous Files C: Program Files (x86) Microsoft Visual Studio 14.0 Common7 IDE Extensions Microsoft Entity Framework Tools Dbgen Ssdltosql10.tt 104

1 answer

0

Line 104 of the file C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\Extensions\Microsoft\Entity Framework Tools\DBGen\SSDLToSQL10.tt contains:

foreach (AssociationSet associationSet in ExistingStore.GetAllAssociationSets())

It means that T4 is not finding its associations for some reason. Two hypotheses:

  1. Your associations are not properly configured;
  2. The database has the Connection string wrong.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.