简体   繁体   中英

How to update only dirty fields in .NET entity framework when using stored procedures for insert,update,delete?

I use .NET entity framework and mapped my database tables to it. i used stored procedures for insert,update, delete.

then I used EntityDataSource in an ASP.NET application which updates a table.

I don't change all the fields of the entity. there are some fields left unused.

the problem is that when the EntityDataSource performs Update Command. It tries to update ALL fields in the entity. so unused fields receive wrong values.

Is There any simple solution using entity framework designer ?

for example can i use original values for non-modified fields?

Don't use a stored procedure.

Unfortunately that's the only answer I have. A SP expects to get the values it's putting in, you can't tell it to only call with some of the parameters filled in.

If you're just letting EF do the updates without a SP, it should be able to handle this more intelligently.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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