CodeSmith Community
Your Code. Your Way. Faster!

DeepSave - A Few Questions / Issues

Latest post 02-12-2007 10:45 AM by Grier. 4 replies.
  • 02-08-2007 3:41 PM

    • Grier
    • Not Ranked
    • Joined on 02-08-2007
    • Posts 6
    • Points 156

    DeepSave - A Few Questions / Issues

    Hey guys,

    I am just getting started with netTiers, but I think I may have run into a bug.

    I am able to DeepLoad a Listing:

                listing = listingService.DeepLoadByListingID(listingID, true,
                    DeepLoadType.IncludeChildren, typeof(TList<ListingToTag>));

    This works fine, and then I try to remove all the child elements from the ListingToTag collection:

                while (listing.ListingToTagCollection.Count > 0)
                    listing.ListingToTagCollection.RemoveAt(0);

    Is there a RemoveAll() function that I am missing here?

    Then on to the DeepSave call:

                listingService.DeepSave(listing, DeepSaveType.IncludeChildren, typeof(TList<ListingToTag>));

    This call is saving the Listing data, but it does not remove the ListingToTag elements.

    Any ideas why this is not working?

    Thanks,

    Grier


     

    Filed under:
    • Post Points: 35
  • 02-09-2007 1:48 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 924
    • Points 34,750

    Re: DeepSave - A Few Questions / Issues

    You should use the "MarkToDelete()" method to indicate an entity should be deleted when you do a DeepSave.

    ie. listing.ListingToTagCollection[ n ].MarkToDelete();

    hth

    swin 

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 02-09-2007 5:28 PM In reply to

    • vcif
    • Top 50 Contributor
    • Joined on 06-18-2006
    • Posts 69
    • Points 1,540

    Re: DeepSave - A Few Questions / Issues

    Reply |Contact |Answer

    swin,

    just to clarify...

    if you use  listing.ListingToTagCollection[ n ].MarkToDelete(); then the entity in the TList has its entitystate changed to Deleted. It will be deleted on the database but will it then be deleted from the TList? Unless something has changed i don't think so.

    i thought we were supposed to use RemoveEntity() which calls MarkToDelete() and moves the entity to the DeletedItems collection in the TList. The datalayer the deletes those items from the database and deletes them from the DeletedItems Collection so that the retruned TList is consitent with the the database

    correct?

    vin

    • Post Points: 35
  • 02-12-2007 3:24 AM In reply to

    • swin
    • Top 10 Contributor
    • Joined on 06-14-2006
    • London, UK
    • Posts 924
    • Points 34,750

    Re: DeepSave - A Few Questions / Issues

    Vin,

    Yes, you are quite correct.  In the instances where I had been using MarkToDelete I wasn't doing anything with the collection after the DeepSave so it made no difference to me, but as you quite rightly state the TList is more consistent with the database when using the RemoveEntity method - so that should be the prefered usage.

    swin 

    ------------------------------------------------- Member of the .NetTiers team -------------------------------------------------
    • Post Points: 35
  • 02-12-2007 10:45 AM In reply to

    • Grier
    • Not Ranked
    • Joined on 02-08-2007
    • Posts 6
    • Points 156

    Re: DeepSave - A Few Questions / Issues

    Thanks guys -

    Should this approach be working for netTiers v2.0?  If so, neither of these techniques have been successful in solving the issue.  If this is a bug in the current version of netTiers, where can I make the modification that will have this work properly?  Do I need to use one of the nightly builds?  I would rather not use one of these builds unless I can be assured that the build is free of bugs.

     

    Thanks,

     

    Grier

     

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