I have a business object that is set up with some of it's properties being other business objects.
So something like
AddressObject OrignAddress { get; set;}
When I am loading a list of this object from a Data Table Adapter the time it takes to return is 90 seconds or so with 1000 records. I am open to any and all suggestions on how to make this faster. If I remove the two lines that are adding the instance of Stops it returns much quicker. I have confirmed that there is nothing in the constructors of any of these that should be causing the slow load times. The full code is posted below:
List<Loads> ldnireturn = new List<Loads>(dtLS.Rows.Count);
for (int x = 0; x < dtLS.Rows.Count; x++ )
{
LoadsDS.LoadDeliveredNoInvoiceRow drLS = dtLS.Rows[x] as LoadsDS.LoadDeliveredNoInvoiceRow;
ldnireturn.Add(new Loads
{
LoadId = drLS.LOAD_ID,
TotalWeight = drLS.IsTOTAL_WEIGHTNull() ? 0 : drLS.TOTAL_WEIGHT,
Cost = drLS.IsTOTAL_COSTNull() ? 0 : drLS.TOTAL_COST,
StopOrigin = new Stops
{
Name = drLS.IsORIG_NAMENull() ? "" : drLS.ORIG_NAME,
City = drLS.IsORIG_CITYNull() ? "" : drLS.ORIG_CITY,
State = drLS.IsORIG_STATENull() ? "" : drLS.ORIG_STATE,
PostalCode = drLS.IsORIG_ZIPNull() ? "" : drLS.ORIG_ZIP
},
StopDest = new Stops
{
Name = drLS.IsDEST_NAMENull() ? "" : drLS.DEST_NAME,
City = drLS.IsDEST_CITYNull() ? "" : drLS.DEST_CITY,
State = drLS.IsDEST_STATENull() ? "" : drLS.DEST_STATE,
PostalCode = drLS.IsDEST_ZIPNull() ? "" : drLS.DEST_ZIP
},
Carrier = new CarrierObj { Name = drLS.CarrierName },
DeliveredDate = Utilities.SafeParse<DateTime>(drLS.DELIVERED_DATE),
LoadTenderDate = Utilities.SafeParse<DateTime>(drLS.LOAD_TENDER_DATE),
CarPro = drLS.IsCARPRONull() ? "" : drLS.CARPRO,
CarrierInvoiceID = drLS.IsCARRIER_INVOICENull() ? "" : drLS.CARRIER_INVOICE
});
}