Hello,
I need a little help with single entity prefectch paths. The goal is to return one row of data
in this case a vendor address and it's type. Here are the tables
Vendors - VendorID (not needed in this example but shown for reference)
VendorAddresses - VendorID, AddressID, AddressTypeID (Join Table between Address and Vendor )
AddressTypes - AddressTypeID (List of Address Types - related to the Join table)
Address - AddressID
I know the addressId - I want to load the addressEntity with the Address type
I am trying this:
IPrefetchPath addressFetchPath = new PrefetchPath((int)EntityType.AddressEntity);
addressFetchPath.Add(AddressEntity.PrefetchPathAddressTypeCollectionViaCustomerAddresses);
address = new AddressEntity(Convert.ToInt64(hdnAddressId.Value), addressFetchPath);
This builds - but the question is how do I access the items in the prefeched path?
and I realy just want one addressType for this address.
SQL would be:
Select StreetLine1,StreetLine2,City,StateID,PostalCode,at.name
from
[Address] a,VendorAddresses va,addressType at
where
a.addressId = va.addressId and
va.addressTypeId = at.addressTypeId and
a.addressId = 190
Which Returns:
Via Nitti, 1A NULL Castano Primo 23 20022 Physical Address
I am trying this:
address.GetFieldByName("AddressType.Name").ToString();
But I do not see any examples of how to access the prefectched data?
Thanks for your help.
Todd