从数据库创建模型时,从表名更改实体名称/ poco类名称 [英] Changing entity name/poco class name from table name while creating model from the database
本文介绍了从数据库创建模型时,从表名更改实体名称/ poco类名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
感谢
Amit
解决方案
您有两个选项,
- 是一点学习曲线,但它涉及使用T4模板自己做代码生成。基本上你将在概念模型中剥离_。 定制实体指南类
- 更简单,更难的是只需导入模型,然后使用模型浏览器并重命名每个实体。你只需要做一次,它将把映射从概念保存到物理。可以通过这里(搜索更改实体名称)
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 the naming convention while the entities are created in the entity framework during the creation of model from database
Thanks, Amit
解决方案
You have two options,
- 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
- 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")
这篇关于从数据库创建模型时,从表名更改实体名称/ poco类名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文