Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
UI or BO code?
Message
From
24/08/2010 19:15:27
Timothy Bryan
Sharpline Consultants
Conroe, Texas, United States
 
 
To
24/08/2010 16:46:27
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Miscellaneous
Thread ID:
01478134
Message ID:
01478249
Views:
24
>>>
>>>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
>
>Where would you suggest being a good place to do this Tim? Have you read through all the other posts in this thread?

Yes, I have Frank. Based on how you are doing this, I think it makes sense to put this in your retrieval method as you suggested. On the other hand, I might have done that differently anyway. You indicated you are creating a new record so you have a history. I wonder if it makes sense to capture the history to a different history table (just the parts you need for the history) while keeping the existing live record able to change state. None the less, that is for you to decide as you know the requirements and I am not intending to second guess your intentions.
If you need to automatically create a new record based on the status, then I would do that on the retrieval. The only problem is if they don't save that record is there any effect on the original record? I would put all that in my business object as it has nothing to do with the UI. I hope that answered your question.
Tim
Timothy Bryan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform