CodeSmith Community
Your Code. Your Way. Faster!

DeepSave problem

Latest post 02-27-2007 8:51 AM by Francisco Campos. 7 replies.
  • 11-10-2006 11:55 AM

    DeepSave problem

    I'm having a problem with DeepSave, and before I bang my head against the wall I want to make sure I'm calling it correctly.  Is this a valid way to call it?  I'm using the Service Layer pattern.  The ObjectMaster has five child collections, which are basically subtypes in the data model.  The 1st child saves OK, and the ObjectMaster saves OK, but children 2 + do not get saved.

       [Test]
      public void DeepSaveObjectMasterAndChildren()
      {
       TList<ObjectMaster> objectMasterList = new TList<ObjectMaster>();
       ObjectMasterService objectMasterService = new ObjectMasterService();
       // Add an Incident
       ObjectMaster incidentParent = objectMasterList.AddNew();
       Incident incident = incidentParent.IncidentCollection.AddNew();
       // Add an Individual
       ObjectMaster individualParent = objectMasterList.AddNew();
       Individual individual = individualParent.IndividualCollection.AddNew();
       // Add a Location
       ObjectMaster locationParent = objectMasterList.AddNew();
       Location location = locationParent.LocationCollection.AddNew();
       // DeepSave all objects
       DataRepository.ObjectMasterProvider.DeepSave(objectMasterList);
      }

    Filed under:
    • Post Points: 5
  • 11-15-2006 9:31 AM In reply to

    Re: DeepSave problem

    My issue appears to go away when I modify "CanDeepSave" per a related post:

                    else if ( deepSaveType == DeepSaveType.IncludeChildren )
                    {
                        if ( innerList.Contains(key) )
                        {
                            innerList.AddProperty(entity, key, property);
                            return true;
                        }
                    }

    I'm waiting to hear from the netTiers team before I consider it solved, however.

    Dave

    Filed under:
    • Post Points: 35
  • 11-15-2006 10:01 AM In reply to

    Re: DeepSave problem

    Hi, that fixes half of the problem, and should work for 60% of the conditions that go through that code.   So it's likely that will work for you.  But the version i will be releasing will be completely different and use WeakReferences on saved objects instead of tracking properties and keys.

    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 11-22-2006 6:29 AM In reply to

    Re: DeepSave problem

    Hello -
    I faced the same problem and I think the right solution is to add not(!) before innerList.HasProperty.. because it doesn't make sense to check if item found then add it again also this is what is used in DeepLoad method

    else if ( deepSaveType == DeepSaveType.IncludeChildren )
                    {
                        if ( innerList.Contains(key) && !innerList.HasProperty(entity, key, property) )
                        {
                            innerList.AddProperty(entity, key, property);
                            return true;
                        }
                    }

    I wanted to view my solution and want to ask if this will affect any other thing in the project or not and what may be affected.
    Please advice
    Regards, Hossam El-Deen Microsoft Certified Technology Specialist(Windows, Web) http://HossamElDeen.blogspot.com
    • Post Points: 35
  • 11-22-2006 8:48 AM In reply to

    • GRAW
    • Top 25 Contributor
    • Joined on 06-23-2006
    • Posts 157
    • Points 4,560

    Re: DeepSave problem

    Hossam,

    that will work in SOME cases, but it's not a complete fix.  Robert is working on a fix that should cover both DeepLoad and DeepSave.  Hopefully he will release it sometime soon.

     GRAW
     

    "Small is the number of them that see with their own eyes, and feel with their own hearts" Albert Einstein
    • Post Points: 35
  • 12-06-2006 2:40 AM In reply to

    Re: DeepSave problem

    Fixed in SVN Rev 433.

    On 11/22/06, GRAW <bounce-GRAW@codesmithsupport.com> wrote:

    Hossam,

    that will work in SOME cases, but it's not a complete fix.  Robert is working on a fix that should cover both DeepLoad and DeepSave.  Hopefully he will release it sometime soon.

     GRAW
     






    Robert Hinojosa
    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams
    http://www.nettiers.com
    -------------------------------------
    • Post Points: 35
  • 12-10-2006 12:04 PM In reply to

    Re: DeepSave problem

    Robert,
    Thanks for your reply and it will be great if you told me how you solved it.

    Thanks and have a nice day
    Regards, Hossam El-Deen Microsoft Certified Technology Specialist(Windows, Web) http://HossamElDeen.blogspot.com
    • Post Points: 35
  • 02-27-2007 8:51 AM In reply to

    Re: DeepSave problem

    Check this post:

    http://community.codesmithtools.com/forums/ShowThread.aspx?PostID=22621#22621

    • Post Points: 5
Page 1 of 1 (8 items) | RSS
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems