[英]EF - Import a new table from DB and have it replace an existing one
So I need to update the model from the db. 因此,我需要从数据库更新模型。 The issue is that I want the new table to replace an existing one. 问题是我希望新表替换现有表。
This is the format of my existing table. 这是我现有表格的格式。
Here is the new table after import it from the DB. 这是从数据库导入后的新表。
I delete the original table and rename the fields to match, build and get errors. 我删除了原始表,并重命名了字段以匹配,构建和获取错误。 I am getting errors because it can't find UserProfileTenant. 我收到错误消息,因为找不到UserProfileTenant。 When I use intellisense I see that it has USR_PROFILE_TENANT2 instead of UserProfileTenant. 当我使用智能感知时,我看到它具有USR_PROFILE_TENANT2而不是UserProfileTenant。
I'm not sure where I need to update to have names properly updated. 我不确定要在何处正确更新名称。
Looking through some questions I found Change DB in EF . 通过一些问题,我发现了EF中的Change DB 。 But the accepted answer isn't the one I used. 但是接受的答案不是我使用的答案。 Its this one by zeeshanhirani . 它的这一个由zeeshanhirani 。
Besure to also update the column mappings after the new table is selected. 选择新表后,还要确保也更新列映射。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.