开发者

Changing entity name/poco class name from table name while creating model from the database

开发者 https://www.devze.com 2023-01-09 18:13 出处:网络
I want to create a entity model from the existing database but all the table names contain \"_\"/underscore in the database so while creating poco classes i want remove underscore from name of the ent

I want to create a entity model from the existing database but all the table names contain "_"/underscore in the database so while creating poco classes i want remove underscore from name of the entities/poco classes. Is there a way to change t开发者_StackOverflow社区he naming convention while the entities are created in the entity framework during the creation of model from database

Thanks, Amit


You have two options,

  1. There is a little bit of a learning curve but it involves using T4 templates to do the code generation yourself. Basically you would just strip out the _ in the conceptual model. guide to customizing entity classes
  2. Easier, and a little more painful is to just import your model and then use the model explorer and rename each entity. You will only have to do this once, it will save the mapping from conceptual to physical. A walk through can be found here (search for "Changing an entity name")
0

精彩评论

暂无评论...
验证码 换一张
取 消