Solved

V URGENT! Object updated in mapper but not in calling code!

Posted on 2004-04-29
5
203 Views
Last Modified: 2010-04-24
I am having trouble with a bug that has popped up in our Object Mapper. If I pass in (to the mapper) an object to be destroyed, during the destruction process, the object is removed from any collections that form part of any bi-directional object relationship that the object is involved in. In the mapper this works fine, but the changes to the collection are not reflected outside of the mapper. Take the following scenario:

I have an object called objDeliveryCategory, which has a collection called allDeliveryBands, which contains 3 DeliveryBand objects. Each of these DeliveryBand objects also has an inverse relationship back to objDeliveryCategory, thus making a bi-directional 1..* relationship.  When I pass in one of the DeliveryBand objects to be destroyed: ObjectMapper.destroyObject(objDeliveryBand), the mapper removes objDeliveryBand from the allDeliveryBands collection that makes up part of the relationship and persists the changes to the collection. This all works fine and the correct rows are removed from the database. When I debug-step through the code in the mapper and use the command window to check the collection after the object has been removed and the collection persisted, I get the following:

?objPInverse.count
2 {Integer}
[Integer]: 2 {Integer}
?objPInverse.oid.ToString() 'Check the oid of the object to ensure it is the same collection
"e94c68fa-e0e9-4816-88af-05190dd74e00"

This is fine as the collection now has just 2 objects. However, once the ObjectMapper.destroyObject(objDeliveryBand) bit is completed, if I continue to step through the code of the subroutine that called the destroyObject function and check the collection that should now be minus one object, I get the following:

?Me.myDeliveryCategory.allDeliveryBands.Count()
3
?Me.myDeliveryCategory.allDeliveryBands.oid.ToString()
"e94c68fa-e0e9-4816-88af-05190dd74e00" 'The oid of the object is the same, so this is the same collection

And the object is still there. The database had been successfuly updated, the mapper seemed to be doing its job, but once out of the mapper, the object hasn't been removed. What is going on? The only thing that I can think of is that the offending collection is somehow being copied within the mapper. Could it be something else? And if not, how could this kind of behaviour happen?

This is an URGENT problem as it is holding up a project with an impending deadline. I've assigned 500 points, but am happy to add more. Any help is greatly appreciated.

Regards.

Stephen.
0
Comment
Question by:sroughley
  • 2
5 Comments
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Did you find a solution to this yourself?

Bob
0
 

Author Comment

by:sroughley
Comment Utility
Ah. I completely forgot about asking this question. Yes, it was solved. It turned out that the interface was caching the objects in the Session StateBag, which removed them from the control of the DAL's IDMap/Cache.
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
Could you clean up this question then?

Thanks,
Bob "Cleanup Volunteer"
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now