in

CodeSmith Community

Your Code. Your Way. Faster!

CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

Last post 03-18-2007 10:12 PM by nochangevn. 33 replies.
Page 2 of 3 (34 items) < Previous 1 2 3 Next >
Sort Posts: Previous Next
  • 11-11-2006 10:40 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Looks great! I'd to check this out but don't see the source in svn and the last nightly build is from October. Any ideas where I would find the source?

    Thanks.

    • Post Points: 5
  • 11-13-2006 8:55 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Thanks Robert! I'll give it a shot however my problem is with DeepLoad rather than DeepSave although I'm sure it is related...
    • Post Points: 5
  • 11-14-2006 1:27 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Isn't it available to the public yet? I mean the new design of both CanDeepLoad and CanDeepSave methods?

    TIA,
    Mehdi

    • Post Points: 35
  • 11-14-2006 10:41 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    This discussion makes me very nervous...

     Dave

    • Post Points: 35
  • 11-14-2006 3:40 PM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Why nervous?! Surprise
    • Post Points: 35
  • 11-14-2006 4:10 PM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Ok, ok, enough of the negative banter.   Embarrassed

    I'm very near a solution, I can post it for all folks that don't use composite primary keys in their m:m relationships, but it will break some implementations and I hate doing that with a solution very close on the horizon.


    Robert Hinojosa

    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams

    http://www.nettiers.com
    -------------------------------------
    • Post Points: 65
  • 11-14-2006 5:47 PM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Robert Hinojosa:

    Ok, ok, enough of the negative banter.   Embarrassed

    I'm very near a solution, I can post it for all folks that don't use composite primary keys in their m:m relationships, but it will break some implementations and I hate doing that with a solution very close on the horizon.

    Hi Robert.

    Would you please let me know how am I supposed to fix the problem already posted in the following url:

    http://community.codesmithtools.com/forums/thread/19850.aspx

    Since I didn't receive any answer, I'm still placed in a dilemma! Hmm

    Any help would be highly appreciated,

    Cheers,
    Mehdi

    • Post Points: 5
  • 11-20-2006 8:49 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Robert, are you getting close on this one?  Not rushing you, of course, just checking in.  :)

     

     

    • Post Points: 35
  • 11-20-2006 11:15 AM In reply to

    • cwelham
    • Top 500 Contributor
    • Joined on 08-31-2006
    • London, UK
    • Posts 10
    • Points 290

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Hi All

    My thanks to the CodeSmith/NetTiers team for producing a great code generator in CodeSmith with a great set of templates in NetTiers.

    I am currently in the process of building a large .NET WebApp project for a client using Visual Studio 2005, SQL Server 2005 and the NetTiers nightly Build v.2.0.0.387 dated 13/11/2006.

    My knowledge of the detail of the NetTier templates is fairly limited thus far (im learnin fast!) however I too have experienced issues with DeepSave using the Service Layer model and have made a slight change to the CanDeepSave method of the DataAccessLayer\Bases\EntityProviderBaseCoreClass.generated.cst template

    The change as detailed below seems to have sorted out my particular issue whereby the innerList.property collection wasnt being populated which prevented the specified children from being DeepSaved, however Ive not have a great deal of time to investigate the full implications of this change are so if anyone can shed some light as to whether this is a sensible change to make or whether there are deeper issues going on with the DeepSave functionality that Bobby et al have been working on, in either case I would be most grateful to be made aware of the outcome.

        protected bool CanDeepSave(IEntity entity, String key, String property, DeepSaveType deepSaveType, ChildEntityTypesList innerList)
            {
                if ( innerList != null )
                {
                    if ( deepSaveType == DeepSaveType.ExcludeChildren )
                    {
                        if ( !innerList.Contains(key) && !innerList.HasProperty(entity, key, property) )
                        {
                            innerList.AddProperty(entity, key, property);
                            return true;
                        }
                    }
                    else if ( deepSaveType == DeepSaveType.IncludeChildren )
                    {
    /* CDW: 14/11/2006 Change to get innerList properties populated (difference is an added ! )
                        if ( innerList.Contains(key) && innerList.HasProperty(entity, key, property) )
    */
                        if ( innerList.Contains(key) && ! innerList.HasProperty(entity, key, property) )
                        {
                            innerList.AddProperty(entity, key, property);
                            return true;
                        }
                    }
                }
                return false;
            }
     

     

    Can someone (Bobby ?) let me know what paid support options are available (including the possibility of me engaging a skilled C# ASP.NET web developer for my project)
    Im hoping that this paid support would include some fuller documentation than is currently publicly available :-)

     

    Regards

    Chris Welham


    Director & IT Consultant
    Traderoute Consultants Ltd 

    Email: chris@traderoute-consultants.co.uk 

     

    • Post Points: 5
  • 11-27-2006 11:44 AM In reply to

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

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

     Robert,

    how is  it going on this issue?  Are you going to have a solution checked in for it anytime soon?

     

    "Small is the number of them that see with their own eyes, and feel with their own hearts" Albert Einstein
    • Post Points: 5
  • 11-29-2006 11:17 AM In reply to

    • shadownlo
    • Not Ranked
    • Joined on 11-29-2006
    • Posts 1
    • Points 35

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Yea that works but for me on 1 entity only after that it stops it doesnt add no new key for other entities

    I changed it into this now it works no idea if i did something wrong but here...

    else if ( deepLoadType == DeepLoadType.IncludeChildren )

    {

    if ( innerList.Contains(key) && !innerList.HasProperty(entity, key, property) )

    {

    innerList.AddProperty(entity, entity.EntityTrackingKey, property);

    // innerList.AddProperty(entity, key, property);

    return true;

    }

    }

    • Post Points: 35
  • 12-01-2006 7:39 PM In reply to

    • tirpitz3
    • Not Ranked
    • Joined on 09-29-2006
    • Posts 5
    • Points 85

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Hey all, I'm not trying to be pushy or anything (I've seen plenty of posts asking how the fix is coming, etc), but...  I just decided to upgrade the version of net tiers the application I develop for today to the latest and ran into this bug.  After about 0.24 seconds of googling, I found that everyone else has run into this problem and its been around for a month now.  I'm wondering what the expected timeframe for the fix is going to be.  If it isn't going to be in the new week or two, I'll just not upgrade.

    Thanks

    • Post Points: 35
  • 12-06-2006 2:42 AM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    Fixed in SVN Rev 433

    On 12/1/06, tirpitz3 <bounce-tirpitz3@codesmithsupport.com> wrote:

    Hey all, I'm not trying to be pushy or anything (I've seen plenty of posts asking how the fix is coming, etc), but...  I just decided to upgrade the version of net tiers the application I develop for today to the latest and ran into this bug.  After about 0.24 seconds of googling, I found that everyone else has run into this problem and its been around for a month now.  I'm wondering what the expected timeframe for the fix is going to be.  If it isn't going to be in the new week or two, I'll just not upgrade.

    Thanks






    Robert Hinojosa

    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams

    http://www.nettiers.com
    -------------------------------------
    • Post Points: 5
  • 12-06-2006 12:21 PM In reply to

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    I tested it with 4 different database implementations that I have, if you guys could give it a spin and let me know your experience with the changes, that'd be awesome.

     Change Log regarding this:

    - [ENH] Auto-Fill of new id's for junction entities when the source objects are created for their respective primary keys.

            protected void Page_Load(object sender, EventArgs e)

            {

     

                LeftTable left = new LeftTable();

                left.LeftColumnName = "MyLeftName8";

     

                RightTable right = new RightTable();

                right.RightColumnName = "MyRightName9";

     

                RightTable right2 = new RightTable();

                right2.RightColumnName = "MyRightName10";

     

                RightTable right3 = new RightTable();

                right3.RightColumnName = "MyRightName11";

     

                left.RightTableCollection_From_RightLeftJunction.Add(right);

                left.RightTableCollection_From_RightLeftJunction.Add(right2);

                left.RightTableCollection_From_RightLeftJunction.Add(right3);

     

                //Add the junction table entities, and add references to the newly created entities. 

                //the identity mappings will occur as each one is updated automatically in the provider.

                RightLeftJunction both = new RightLeftJunction();

                both.LeftColumn1PKSource = left;

                both.RightTablePKSource = right;

     

                RightLeftJunction both2 = new RightLeftJunction();

                both2.LeftColumn1PKSource = left;

                both2.RightTablePKSource = right2;

     

                RightLeftJunction both3 = new RightLeftJunction();

                both3.LeftColumn1PKSource = left;

                both3.RightTablePKSource = right3;

     

                left.RightLeftJunctionCollection.Add(both);

                left.RightLeftJunctionCollection.Add(both2);

                left.RightLeftJunctionCollection.Add(both3);

     

                using (TransactionManager tm = DataRepository.Provider.CreateTransaction())

                {

                    tm.BeginTransaction();

                    DataRepository.LeftTableProvider.DeepSave(tm, left);

                    tm.Commit();

                }

            }


     
    - [ENH] Deep [Loading/Saving] Events now expose everything about it's current deep session, including canceling and skipping items in the session.  Including the ability to cancel your session.  There is a new class called NS.Data.Bases.EntityProviderBaseCore<Entity, EntityKey>.DeepSessionEventArgs

                  -- example:


    DataRepository.LeftTableProvider.DeepSaving += new  NS.Data.Bases.EntityProviderBaseCore<LeftTable,LeftTableKey>.DeepSavingEventHandler( LeftTableProvider_DeepSaving);

    DataRepository.LeftTableProvider.DeepSave(tm, left);

     

    ... 

     

            private void LeftTableProvider_DeepSaving(object sender, chimbaloo.Data.Bases.DeepSessionEventArgs e)

            {

                Writer(e.Skip);

                Writer(e.Cancel);

                Writer(e.DeepTypeValue.ToString());

                Writer(e.DeepSession.Count);

                Writer(e.CurrentEntity != null ? e.CurrentEntity.GetType().FullName : "");

                Writer(e.CurrentEntityList != null ? e.GetType().FullName : "");

                Writer(e.CurrentTypePropertyKey);

            }



    - [ENH] Created DeepSession class using a weak reference to monitor loaded entities and lists based on key.

                 -- internal changes, DeepSession inherits from List<string> to store the types to load, but also uses a WeakReferenceDictionary for the objects.
       

    - [REF] Changed Deep* from depth first to breadth first, using a delegate mapping to the deep call.

               -- now for each call, after a Load or Save is performed, it checks to see if it can go deep, if possible, then it adds a delegate handle of the call:  This way the entire set of local properties can be loaded prior to going deep.  This was an issue, when you had a M:M relationship being loaded and itself contains a relationships back to another child object, and it would fill the other child within the M:M instead of inside it's sibling property.

                Dictionary<Delegate, object> deepHandles = new Dictionary<Delegate, object>();

                ...

                deepHandles.Add(

                    (DeepLoadHandle< OrderDetails >) DataRepository.OrderDetailsProvider.DeepLoad,

                        new object[] { transactionManager, entity.OrderDetailsCollection, deep, deepLoadType, childTypes, innerList }

                    );

                ...

                foreach(KeyValuePair<Delegate, object> pair in deepHandles)

                {

                    pair.Key.DynamicInvoke((object[])pair.Value);

                }


    - [REF] Removed DeepLoad M:M methods from the ability to call nested levels of DeepLoading, the M:M property itself can be loaded in a deep load, but it doesn't recursively follow down that branch (easily fall into cyclical branches).
                --   Again, similar to the problem above, a M:M relationship will always have a nested child property back to the parent.   So, even tracking loads, lots of wasted CPU cycles were being spent in those nested branches, so it made all the sense to simply remove the ability for the M:M properties in a type to not be deep loaded, since the intent is for it to be loaded locally and not within the nested m:m relationship.

    - [ENH] Added a more likely to be unique GetHashCode() implementation for Entities.

                 -- This is useful for the loading process and possibly could be extended to be used as the EntityTrackingKey in future versions.

    - [ENH] Enhanced the EntityTrackingKey to use a pipe delimeter between keys in composite key types

                 -- This avoids collisions with composite keys using integer values
     


    Robert Hinojosa

    -------------------------------------
    Member of the Codesmith Tools, .netTiers, teams

    http://www.nettiers.com
    -------------------------------------
    • Post Points: 5
  • 01-30-2007 3:44 AM In reply to

    • GASTAN
    • Top 75 Contributor
    • Joined on 11-22-2006
    • Posts 53
    • Points 1,190

    Re: CanDeepSave bug in .netTiers v2.0.0.387 ( I think )

    I still seem to have problems with deepsaving in

    .netTiers v2.0.1.447
    12/14/2006 Release 2.0.1.449

    Deleting item with subitems triggers FK violation.

     

    • Post Points: 35
Page 2 of 3 (34 items) < Previous 1 2 3 Next >
Copyright © 2008 CodeSmith Tools, LLC
Powered by Community Server (Commercial Edition), by Telligent Systems