简体   繁体   English

告诉实体框架忽略自定义数据库表

[英]Tell Entity Framework to ignore custom database tables

Is it possible to tell Entity Framework to ignore any custom tables I add to the database. 是否可以告诉Entity Framework忽略我添加到数据库中的任何自定义表。 For example, say if I use the sqlmemberhipprovider in the same database as the one used for EF, can I tell EF to just ignore whatever tables I haven't already created classes for? 例如,假设如果我在与用于EF的数据库相同的数据库中使用sqlmemberhipprovider,是否可以告诉EF忽略我尚未为其创建类的任何表? Right now, it's giving the error 现在,它给了错误

"The model backing the 'xxx' context has changed since the database was created. Consider using Code First Migrations to update the database ( http://go.microsoft.com/fwlink/?LinkId=238269 ). " “自创建数据库以来,支持'xxx'上下文的模型已更改。请考虑使用代码优先迁移来更新数据库( http://go.microsoft.com/fwlink/?LinkId=238269 )。“

I don't want EF to do anything on the extra tables it doesn't recognize. 我不希望EF对它无法识别的额外表执行任何操作。

I figured out what I was doing wrong. 我发现自己在做什么错。 It wasn't the Membership tables that were causing the problem it was another table I deleted manually that EF was tracking. 不是由Membership表引起问题的,而是EF正在跟踪的另一个我手动删除的表。

您是否尝试过将初始化程序设置为null?

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM