CodeSmith Community
Your Code. Your Way. Faster!

TList Child Collection Not Generated

Latest post 06-14-2008 9:59 AM by drhoten. 5 replies.
  • 06-05-2008 9:11 PM

    • drhoten
    • Top 500 Contributor
    • Joined on 03-23-2007
    • Posts 15
    • Points 165

    TList Child Collection Not Generated

    Hi All -

    I just tried upgrading from .netTiers 2.2.0.603 to 2.2.0.732 today and ran into an issue where a TList Collection was not generated for a many to many relationship.

    I am using CodeSmith 4.1.4 revision 3592 from the command line and my current DB schema (which has not been changed) worked just fine in 603, but now when I re-generated it's missing a TList Collection in the Children Collections region of the CustomerBase.generated.cs

    Here's the schema that I am currently using - the join table has only two fields and uses a composite primary key as required by .netTiers.

    Customer                     CustomerAccountMatrix        Account
    --------------                      -----------------------------------       -------------
    CustomerID PK  -->       CustomerID PK               <-- AccountID PK
    OtherFields                   AccountID   PK                    OtherFields

     I am expecting to see in CustomerBase.generated.cs

            /// <summary>
            ///    Holds a collection of CustomerAccountMatrix objects
            ///    which are related to this object through the relation FK_CustomerAccountMatrix_Customer
            /// </summary>   
            [System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
            public virtual TList<CustomerAccountMatrix> CustomerAccountMatrixCollection
            {
                get { return entityData.CustomerAccountMatrixCollection; }
                set { entityData.CustomerAccountMatrixCollection = value; }   
            }

      but found this instead

            /// <summary>
            ///    Holds a CustomerAccountMatrix object
            ///    which is related to this object through the relation CustomerAccountMatrix
            /// </summary>
            [System.ComponentModel.Bindable(System.ComponentModel.BindableSupport.Yes)]
            public virtual CustomerAccountMatrix CustomerAccountMatrix
            {
                get { return entityData.CustomerAccountMatrix; }
                set { entityData.CustomerAccountMatrix = value; }   
            }

    Hopefully someone can point me in the right direction, or even let me know what template to look at to trouble shoot this.

    Thanks.

    Doug

    • Post Points: 5
  • 06-06-2008 8:02 AM In reply to

    • drhoten
    • Top 500 Contributor
    • Joined on 03-23-2007
    • Posts 15
    • Points 165

    Re: TList Child Collection Not Generated

    I started looking at this again this morning, and noticed that another collection was generated differently than what I was expecting.

    AccountCollection_From_CustomerAccountMatrix

    was generated as

    AccountIDAccountCollection_From_CustomerAccountMatrix 

    I see there is a new template propery ColumnClassNameFormat, but would not have excepted to see that used here - perhaps it's time for another cup of coffee...

    Doug

    • Post Points: 35
  • 06-06-2008 5:58 PM In reply to

    • CitizenBane
    • Top 50 Contributor
    • Joined on 10-30-2007
    • Grand Rapids, MI
    • Posts 94
    • Points 1,740

    Re: TList Child Collection Not Generated

    Reply |Contact |Answer

    Thanks for the report. Smile  We'll look in to it, too.

    Don't forget, If you want to make it "official", go to http://code.google.com/p/nettiers/issues/list and submit this bug report there.
    If you do end up fixing it before we do, we'd love to see a patch.

     

    I'm outside ur box, shiftin' ur paradigm.
    • Post Points: 35
  • 06-08-2008 4:59 PM In reply to

    • drhoten
    • Top 500 Contributor
    • Joined on 03-23-2007
    • Posts 15
    • Points 165

    Re: TList Child Collection Not Generated

    Ok, I just made it official.

    I did not have a chance to look into much further, but did replace the affected code with working code from my last lableled build and everything compiled. So I suppose that's a good sign. I will test it out tomorrow and make sure that nothing else is broken and will try to dig into this later in the week.

    Doug 

    • Post Points: 5
  • 06-12-2008 9:56 AM In reply to

    • drhoten
    • Top 500 Contributor
    • Joined on 03-23-2007
    • Posts 15
    • Points 165

    Re: TList Child Collection Not Generated

    Heres' the link the official bug for this issue.

    http://code.google.com/p/nettiers/issues/detail?id=48

    • Post Points: 5
  • 06-14-2008 9:59 AM In reply to

    • drhoten
    • Top 500 Contributor
    • Joined on 03-23-2007
    • Posts 15
    • Points 165

    Re: TList Child Collection Not Generated

    This issue can be closed as it is not a bug. (I already this comment to the Google Code Project.)

    At first I thought the function IsRelationOneToOne in CommonSqlCode.cs was incorrectly identifying the relationship as 1-to-1.

    After stepping through the code generation however, I found it was correct - I had forgotten Embarrassed about a unique constraint that I had added to CustomerAccountMatrix.CustomerID.

    So, when the code that was originally generated created the TList CustomerAccountMatrixCollection in the Customer entity I went ahead and used it. It turns out I should have been using the TList CustomerAccountMatrixCollection in the Account entity instead.

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