Ignore Properties in OnModelCreating

怎甘沉沦 提交于 2019-12-04 17:12:35

It looks like you're ignoring the class but you also need to ignore the property.

Ignore(o => o.Colors);

I've ignored scalar properties in apps before (and did that in the video you saw :) ) but not navigation properties, so I just tested to ensure that the model builder is happy with it. And it is. But you should just do a few integration tests to make sure it all works as expected in your app.

doug srofe

I know this is an old post and you probably have figured this out, though this may help someone else. The Ignore works well in a 1-1 scenario. The 1-Many is the issue.

In your example above, you would need to do the following:

 modelBuilder.Ignore<ICollection<Color>>();
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!