如何删除两个动态对象之间的多对多关系?
我想删除两个动态实体之间的多对多关系。
我见过使用虚拟对象的示例,但它们不是动态的。在运行时之前我不会知道对象或对象集合导航属性的名称。所以我不能只是说,
apple.Oranges.Remove(orange)
我需要动态地去做。比如,
dynamicModel.dynamicCollection(collectionName).Remove(otherDynamicModel)
我不一定需要扩展方法,只是需要完成工作的方法。我该怎么做?谢谢。
(由于对象是动态的,我不知道提供哪些其他详细信息可能会有所帮助?)
I want to delete the many-to-many relationship between two dynamic entities.
I've seen examples using dummy objects, but they were not dynamic. I will not know the object or the name of the objects' collection navigation properties until run-time. So I can't just say,
apple.Oranges.Remove(orange)
I need to do it dynamically. Something like,
dynamicModel.dynamicCollection(collectionName).Remove(otherDynamicModel)
I don't need extension methods necessarily, just something that gets the job done. How can I do this? Thanks.
(I don't know what other details might be helpful to provide since the objects are dynamic?)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为在这种情况下你最好还是使用反射:
或者如果你知道它将是一个
IList
I think you're best off using reflection in this case still:
Or if you know it will be an
IList