EF4 is throwing an error "Schema specified is not valid"

irperez picture irperez · Jun 15, 2010 · Viewed 41.6k times · Source

I'm getting a weird EF4 "Entity Framework v4" error when I do a select on the context.

There I get is:

Schema specified is not valid. Errors: The relationship 'AnalyzerConfigurationModel.FK_AnalyzerMetadataParameters_AnalyzerMetadata' was not loaded because the type 'AnalyzerConfigurationModel.AnalyzerMetadataParameter' is not available.

The query to generate the error is:

Using context As New AnalyzerConfigurationEntities
      Dim EFAnalyzerConfiguration = (From P In context.AnalyzerConfigurations
                                     Where P.Name = analyzerConfigurationName).FirstOrDefault
End Using

The schema is show below. alt text

I've checked the connection strings, multiple times, its not that. Everything looks fine. I'm not sure if the XML that gets generated from this schema is off or not. But looked there too and don't see anything off or different from other properties. Has anyone run into this one before?

Answer

CWaters picture CWaters · Feb 12, 2013

I found that if I expanded the EDMX file in solution explorer (VS 2012) and right clicked on each .tt file and selected Run Custom Tool also fixed the issue. This might be easier than de