Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

System.ArgumentException: The modelEntityContainerName parameter contains characters that are not valid

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

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.

Thanks.

like image 530
Kim Avatar asked Sep 21 '12 16:09

Kim


1 Answers

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.

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

like image 138
Thomas McNamee Avatar answered Nov 09 '22 02:11

Thomas McNamee