0

我已将我在 EF 4.0 中的项目更新为 EF 4.3.1。但是,当我创建一个新的 Context 对象时,会引发异常:

Culture is not supported.
Parameter name: name
2.3.2 is an invalid culture identifier.

完整的堆栈跟踪:

at System.Globalization.CultureInfo..ctor(String name, Boolean useUserOverride)
at System.Globalization.CultureInfo..ctor(String name)
at System.Reflection.AssemblyName.nInit(RuntimeAssembly& assembly, Boolean forIntrospection, Boolean raiseResolveEvent)
at System.Reflection.AssemblyName..ctor(String assemblyName)
at System.Data.Metadata.Edm.MetadataAssemblyHelper.ComputeShouldFilterAssembly(Assembly assembly)
at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.Metadata.Edm.DefaultAssemblyResolver.<GetAlreadyLoadedNonSystemAssemblies>b__0(Assembly a)
at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetAllDiscoverableAssemblies()
at System.Data.Metadata.Edm.DefaultAssemblyResolver.GetWildcardAssemblies()
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.LoadResources(String assemblyName, String resourceName, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoaderCompositeResource.CreateResourceLoader(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataArtifactLoader.Create(String path, ExtensionCheck extensionCheck, String validExtension, ICollection`1 uriRegistry, MetadataArtifactAssemblyResolver resolver)
at System.Data.Metadata.Edm.MetadataCache.SplitPaths(String paths)
at System.Data.Common.Utils.Memoizer`2.<>c__DisplayClass2.<Evaluate>b__0()
at System.Data.Common.Utils.Memoizer`2.Result.GetValue()
at System.Data.Common.Utils.Memoizer`2.Evaluate(TArg arg)
at System.Data.EntityClient.EntityConnection.GetMetadataWorkspace(Boolean initializeAllCollections)
at System.Data.Objects.ObjectContext.RetrieveMetadataWorkspaceFromConnection()
at System.Data.Objects.ObjectContext..ctor(EntityConnection connection, Boolean isConnectionConstructor)
at System.Data.Objects.ObjectContext..ctor(String connectionString, String defaultContainerName)
at Stoque.ECM.Modelo.Contexto..ctor() in D:\ECM 2.0\Stoque.ECM\Stoque.ECM.Modelo\Stoque.Modelo.Designer.cs:line 159
at Stoque.ECM.Servico.ServicoECM.ObterUsuarioPorLogin(String login) in D:\ECM 2.0\Stoque.ECM\Stoque.ECM.Servico\Classes\Usuarios.cs:line 331

我不知道这个问题...

我会很高兴有任何帮助。

提前致谢

4

1 回答 1

1

看起来您的一个程序集的文化不正确。出于性能原因,默认情况下,Entity Framework 会过滤掉很可能没有实体的程序集,例如属于 .NET Framework 的程序集或 Microsoft 提供的程序集。实体框架正在使用公钥令牌来过滤掉这些程序集。要获取公钥令牌,AssemblyName 对象是使用 assembly.FullName 创建的。如果 assembly.FullName 不是有效的程序集名称,您将看到上述异常。

于 2012-05-02T21:13:03.740 回答