How to handle creating / editing an entity in a master part

I am wondering what strategies people use to handle creating and editing an object in setting up a master part. (Our application is an Internet-enabled desktop application.)

Here's how we are currently handling this: a form is created in the pop-up window for the object that needs to be edited, and we give a copy of the object. When the user clicks the Cancel button, we close the window and completely ignore the object. When the user clicks the OK button, the main view is notified and receives the edited object. It then copies the properties of the modified object to the original object using originalEntity.copyFrom (modifiedEntity). In case we want to create a new object, we pass an empty object to the pop-up window, which the user can edit as if it were existing. The main view is to decide whether to "insert" or "update" the entities that it receives into the managed collection.

I have some questions and comments on the above document:

  • who should handle the creation of a copy of the object? (master or part)
  • we use copyFrom () to exclude the possibility of replacing objects in the collection, which can lead to breaking links. Is there a better way to do this? (implementing copyFrom () can be tricky)
  • new objects get an identifier of -1 (which uses the server level / hibernation to distinguish between insert or update). This can cause problems when searching (caching) objects by identifier before saving them. Should we use a temporary unique identifier for each new entity instead?

Can anyone share tips and tricks or experiences? Thanks!

. , , , / , /.

+3
3

. , "" . . .

? ( )

. . . ItemChanged, , . NewItem .

copyFrom(), , . ? ( copyFrom() )

copyFrom() . , , [index] . , - . , ItemChanged. , , .

-1 ( / ). () . ?

? Hibernate Unit of Work, , . . , .NET, Java . - .

, !

+1

CSLA .

, :

, .

. , .

, , -.

CSLA IsDirty(). , , , , , ( , - )

INotifyPropertyChanged.

:

. , , , . , MVC MVP.

, - , , .

, GUID , , . , ( ).

, CSLA , .

: CSLA n-, , CopyFrom, ( )).

0

​​. NH, Oracle Db.

-.

, .

, . Save Detail Asp.NET.

" ", "" "" ajax JQuery , .

"" - ( ) .

, , .

also, if you like, you can use jQuery Modal to pop up this panel instead of adding below the line.

Hope this helps :) Thanks,

0
source

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


All Articles