Multi level - Fields mapped on related fields.

Posts   
 
    
arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 25-May-2006 22:51:15   

I'd like to be able to specify deeper levels of fields on related fields designed through the designer.

For example: If I have a chain of n:1 relations order -> Customer -> Country It would be nice to be able to treat Country.CountryName as Order.CustomerCountryName.

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 26-May-2006 08:25:04   

I think you can do this manually as follows.

1- use a prefetchPath to fetch Customer & Country alog with the Order Entity. 2- Add a new property to your Order Entity class called CustomerCountryName. (manually in the code generated) 3- I the Get method of this property, return the Order.Customer.Country.Name.

arschr
User
Posts: 894
Joined: 14-Dec-2003
# Posted on: 02-Jun-2006 23:28:53   

Yes, at least for readonly fields it is working for me so far.


#region Custom Entity code
        
// __LLBLGENPRO_USER_CODE_REGION_START CustomEntityCode
    /// <summary> Gets the value of the related field this.CgmBansEntity.SubproviderEntity.Suprovider.</summary>
    public virtual System.String Subprovider
    {
      get
      {
        SubproviderEntity relatedEntity = this.CgmBansEntity.SubProviderEntity;
        if (relatedEntity != null)
        {
          return relatedEntity.Subprovider;
        }
        else
        {
          return (System.String)TypeDefaultValue.GetDefaultValue(typeof(System.String));
        }
      }

    }
// __LLBLGENPRO_USER_CODE_REGION_END
#endregion