Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
UI or BO code?
Message
De
24/08/2010 16:09:35
Timothy Bryan
Sharpline Consultants
Conroe, Texas, États-Unis
 
 
À
24/08/2010 15:56:00
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Titre:
Divers
Thread ID:
01478134
Message ID:
01478219
Vues:
25
>
>Hi Linda,
>
>I did not get any other message from you besides this one, so no problem.
>
>I would prefer to not do this at the point of saving, as it just doesn't seem right to me. One of the other complications I foresee is if the save does not work, due to some business rule failing, then I'll have to track the fact that I've already copied the old entity to a new entity and not do it again. Whereas, if I do it at the point of getting the entity, I should be able to just substitute the old entity with the new one and then everything else should just work. I was looking at HookPostGetEntity(), but what I tried does not work (just switching the state to Adding).
>
>If I could trap the fact that the status is Pending, then create a new entity, copy the data from the old entity to the new one and return the new entity, that would work too, but I don't know how to do that in MM.NET.


That would be a simple way to do it Frank.

Retrieve your entity into a local entity object and check the status
PolicyEntity entityOriginal = this.GetEntity(get your initial entity)
if status = "whatever"
PolicyEntity entityNew = this.NewEntity()
entityNew.field1 = entityOriginal.field1;
etc.

If your method returns an entity object then just return the entityNew when you are done.

I would probably extract my copy stuff into a separate method in your biz obj to copy all the properties over. I am sure with some effort you could do this by looping through all the properties making it a bit more generic. Then just change the ones you need like status to what you need.
Tim
Timothy Bryan
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform