dimanche 5 mars 2017

How orginize data saving with entoty-dto-request design pattern?

Suppose there is an entity with some data. So send this data via network it is needed to transform this data in to dto. Dto can not be mapped as field to field. Also for network transmission it is needed to serizalize dto into bytes.

So what is the problem? The problem is I do not understant what to save in database. At first glace, only the entity should be saved. But what if there is a bug with entity-to-dto transforming? So it is (probably) needed to save dto too. Also there can be a situation when supporter from receiving system tell that transmitted data is wrong. So network bytes whould be also save in ... database. Note that bytes can not be replaced with json or xml.

As you can see saving all data (entity,dto and bytes) is too much. Also when dto is saved it should have id and foreign key to the entity, so ti became entity too. As a variant byte and dto can be saved to the log files and deleted later. But also storing log for log time is not best practise as I think, also searching can be a problem.

So what from entity, dto and bytes should be saved and where?

Some notes

Of course there can be something wrong with using designin dto, entity logging using. You can write about all prolems in answer or comments.

Aucun commentaire:

Enregistrer un commentaire