简体   繁体   English

实体框架代码首先在数据库中重命名模型/表

[英]Entity Framework Code first rename models/tables in Database

I need to upload a project from Visual Studio to Azure, but I have to share the same DB with other projects. 我需要将项目从Visual Studio上传到Azure,但是我必须与其他项目共享同一数据库。 So I guess I need to rename all my models that creates the tables in the DB to prevent any conflict with other projetcs model/tables!? 因此,我想我需要重命名所有在数据库中创建表的模型,以防止与其他projetcs模型/表冲突!

I started to change the name of one the model and then continued to change in the code and also in IdentityModels.cs file, but will this really work? 我开始更改一个模型的名称,然后继续在代码以及IdentityModels.cs文件中进行更改,但这是否真的有效? Do I need to change in other files also? 我还需要更改其他文件吗? One way to simplify it all, would be to use search and replace, but then I have no control of what is changed! 简化这一切的一种方法是使用搜索和替换,但是后来我无法控制更改内容!

Any good advice how to replace name of table in DB and all instances? 有什么好的建议如何在数据库和所有实例中替换表名?

我认为如果您在创建数据库链接后更改了模型,就会有一个迁移计划: https : //msdn.microsoft.com/zh-cn/data/jj591621.aspx

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 实体框架代码第一个数据库未与模型同步 - Entity Framework code first database not synced with models 是否可以将数据库优先模型和代码优先模型与实体框架混合使用? - Is it possible to mix database first and code first models with entity framework? 是否可以使用实体框架数据库优先方法从数据库表创建的模型之外创建视图模型? - Is it possible to create view models by out of models created from database tables using entity framework DB first approach? 首先在实体框架数据库中批量重命名类 - Batch Rename Classes in Entity Framework Database First Code First Entity Framework不使用表创建数据库 - Code First Entity Framework does not create database with tables 首先向实体框架数据库中的数据库添加表 - Adding tables to database in Entity Framework Database first 在实体框架中扩展和自定义代码优先模型 - Extending and Customizing Code First Models in Entity Framework 实体框架代码首先使用不同项目中的模型 - Entity Framework Code first with models in a different project 重新生成实体框架代码优先模型 - Regenerate Entity Framework Code First Models 如何在不丢失数据的情况下重命名 Entity Framework 5 Code First 迁移中的数据库列? - How to rename a database column in Entity Framework 5 Code First migrations without losing data?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM