public void Get(int contactId) { SqlStoredProcedureAccessor sp = new SqlStoredProcedureAccessor("net_businessEntity_contact_get_batch"); sp.Parameters.Add("@contactId", SqlDbType.BigInt); sp.Parameters.SetLong("@contactId", contactId); SqlDataReaderAccessor reader = null; ArrayList addressIDs = new ArrayList(); try { // // net_businessEntity_contact_get_batch will return the objects contained in a business in the following order: // // - descriptions // - phones // - emails // - addresses reader = sp.ExecuteReader(); // // Read the descriptions // Descriptions.Read(reader); // // Read the phones // if (true == reader.NextResult()) { Phones.Read(reader); } // // Read the emails // if (true == reader.NextResult()) { Emails.Read(reader); } // // Read the addresses // if (true == reader.NextResult()) { addressIDs = Addresses.Read(reader); } } finally { if (reader != null) { reader.Close(); } } // // These calls will make separate sproc calls, so we have to close our reader first. // Addresses.Populate(addressIDs); #if never // // Call get method on sub-objects personName and UseType // should have been populate by contacts.get() method; // Descriptions.Get(contactId, EntityType.Contact); Phones.Get(contactId); Emails.Get(contactId); Addresses.Get(contactId); #endif }