EF4 ASP.NET - Entity Change Management between HTTP Messages and Rollback

I am struggling with the following use case:

The user modifies an existing order. The order is complex - a lot of related "entities" (addresses, message options, suppliers, models, models, various elements, etc.). After a few http messages.

User wants to discard changes.

-

I have an order object, and when the user edits this, I make various changes to the entity association, for example, by changing order.address, order.items.add (item) ...

In one post this is normal, but through the posts I donโ€™t know how best to store the state. If I store objects, then I cannot save the changes, because they are in different data contexts. I read that it is bad practice to keep the data context in a session state, i.e. a long-lived context. I cannot save the changes after each edit / post, because I cannot roll back (?). I really would like to work with objects during the editing process, and not with one big save at the end (accepting the user interface settings and applying them in one fragment).

This should be a fairly common problem - it drives me crazy. Any help is really appreciated.

Hooray!

+3
2

, - .

- , -, . . , -, , , , .

, , - , . , . n , , .

+1

, . MVC. ASP.NET MVC ViewModel // .., / - ( , Business.Entities). DTO.

Disconnected EF. , ViewModels/DTO, . , , , , , .

// ViewModels/DTO. , HistoryList<T> ( List<T>, ).

/Workflow/Component ViewModel/DTO , .

, , , .

/KP

+1

Source: https://habr.com/ru/post/1756751/


All Articles