.Net EntityFramework SaveChanges删除行 [英] .Net EntityFramework SaveChanges Delete Rows

查看:138
本文介绍了.Net EntityFramework SaveChanges删除行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨专家,



我正在开发一个使用entityframework来存储数据的应用程序。我有一些没有太多数据的列。因此,我在启动时加载所有表并在缓存上工作。

当我调用savechanges时,所有更新和插入都正确地存储在我的数据库中。我的问题是删除行。当我调用savechanges时,行仍然存在,Framework只删除了refrencial键。

有没有办法让savechanges从数据库中删除行而不只是取消引用它们?



亲切的问候

Manu

Hi Experts,

i am developing an application that uses entityframework to store the data. I have some columns with not too many data. Therefore i load all tables at Startup and work on the Cache.
When i call savechanges all updates and inserts are stored correctly in my database. My Problem is deleting the rows. When i call savechanges the rows still exist, the Framework just removes the refrencial keys.
Is there a way to let savechanges delete the rows from the database and not just dereference them?

Kind Regards
Manu

推荐答案

你必须调用特定对象集的DeleteObject方法。



文档
You have to call the "DeleteObject" method of the specific objectset.

Documentation


这篇关于.Net EntityFramework SaveChanges删除行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆