System.ArgumentException:modelEntityContainerName参数包含无效字符 [英] System.ArgumentException: The modelEntityContainerName parameter contains characters that are not valid

查看:106
本文介绍了System.ArgumentException:modelEntityContainerName参数包含无效字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试对SQLServer数据库使用Entity Frameworks Power Tools反向工程师代码优先,并收到以下错误:

I've tried to use Entity Frameworks Power Tools Reverse Engineer Code First for a SQLServer database and received the following error:


System .ArgumentException:modelEntityContainerName参数'testContext'包含无效的字符。 namespaceName,String modelEntityContainerName)

     Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)

System.ArgumentException: The modelEntityContainerName parameter 'testContext' contains characters that are not valid.
    at System.Data.Entity.Design.EntityModelSchemaGenerator..ctor(EntityContainer storeEntityContainer, String namespaceName, String modelEntityContainerName)
    at Microsoft.DbContextPackage.Handlers.ReverseEngineerCodeFirstHandler.ReverseEngineerCodeFirst(Project project)

有什么我可以做的,以继续或避免此错误或解决它。

Is there something I can do to continue or avoid this error or work around it.

谢谢。

推荐答案

我遇到了同样的问题。我的数据库名为sots-version-005,并且代码未转义该名称。答案是重命名数据库,希望您处在易于实现的开发环境中。

I had the same problem. My database was named sots-version-005, and the code was not escaping the name. The answer is to rename the database, and hopefully you are in a development environment where that is easy to do.

我使用SQL Management Studio,在数据库上单击鼠标右键,并将其重命名为 sots5,消除了除字母数字之外的所有字符。

I used SQL Management Studio, right-clicked on the database, and renamed it 'sots5', eliminating all characters except alphanumerics.

这篇关于System.ArgumentException:modelEntityContainerName参数包含无效字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆