I'm using adapter, I want to know if a child collection fetched or not. For example, a Customer entity has a SalesOrders collection, which contains the sales orders belonged to the customer.
In some procedures, i only fetch customer entity without any preftech path, therefore, the order collection is empty.
However, in other procedures, it is required to access the data in SalesOrder collection, if it is not fetched and empty, it may cause wrong calculation in my procedure, so I want to fetch it before I call this procedure if it is not fetched.
void CalculateOutstandingOrderBalance(CustomerEntity customer)
{
EntityCollection orders = customer.Orders
/**********************
//if orders is not fetched, fetch it first
/**********************
{
DataAccessAdapter adapter = new DataAccessAdapter();
adapter.FetchEntityCollection(orders, customer.GetRelationInfoOrders());
}
// Some calculation and business logic here
// and update data to database
}
I want to know how to detect if the collection is fetched or not?
and what will happen if collection is fetched and I fetch it again?
Thank you very much