James Ray Anderson

James Ray Anderson
James Ray Anderson
0 comments

The modelEntityContainerName parameter ...not valid

6:00 PM
When using the Entity Framework and using the Reverse Engineer of the Entity Framework Power Tools Beta 2 if your database has invalid characters in the database name such as:
  • Hyphen
  • Period
  • Any special character
For example, the database name was LittleShopOfHorrors-Dev contains a hyphen.  When running the Reverse Engineer you get the following error using Entity Framework 5:
System.ArgumentException: The modelEntityContainerName parameter 'PDShopLittleShopOfHorrors-DevContext' 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)

So, how do you get around it?
  • Rename the database to use an underscore instead
  • Do a Code First another way, such as building your models and using the model builder.

0 comments:

 
Toggle Footer
Top