Hello LLBLGen pro support
LLBLGen Pro 2002 - 2006
Version 2.0.0.0 Final
Release February 14th, 2007
I have a piece of code that I pull records from a table DevicePointSchedule and I prefetch a required Device record with it, however once in a while one of the records does not get its Device record, even though it is not possible to have a DevicePoint without a Device record by SQL dependency. Is this possible? I mean was there a bug on the system? Or could I just be pushing the limits here? This function bellow is called a couple of hundred times a minute.
public static bool Get_DevicePointScheduleEC (int PSCHRecordsPerBlock,
out EntityCollection<DevicePointScheduleEntity> DPSEC)
{
bool RetVal = false;
DateTime MaxProcessDateTime = DateTime.UtcNow.AddSeconds(5);
//Create new DevicePointSchedule entity collection
DPSEC = new EntityCollection<DevicePointScheduleEntity>();
/// prefetch constructor
PrefetchPath2 DPStoDD = new PrefetchPath2((int)EntityType.DevicePointScheduleEntity);
DPStoDD.Add(DevicePointScheduleEntity.PrefetchPathDeviceData)
.SubPath.Add(DeviceDataEntity.PrefetchPathChannel);
//Create 'WhereClause' bucket to hold all the 'WhereClausePhrase' predicates
RelationPredicateBucket WhereClause = new RelationPredicateBucket();
//Create 'WhereClausePhrase' predicate
IPredicateExpression WhereClausePhrase = new PredicateExpression();
WhereClausePhrase.Add (DevicePointScheduleFields.ProcessEnabled == 1);
WhereClausePhrase.AddWithAnd(DevicePointScheduleFields.ProcessDateTime <= MaxProcessDateTime);
//Add 'WhereClausePhrase' predicate to the 'WhereClause' bucket
WhereClause.PredicateExpression.Add(WhereClausePhrase);
//Create empty sorting expression
SortExpression SortExpr = new SortExpression();
SortExpr.Add(DevicePointScheduleFields.ProcessDateTime | SortOperator.Ascending);
//Create the data adapter to be used
using (DataAccessAdapter DAA = new DataAccessAdapter())
{
//Perform the fetch and prefetch
DAA.FetchEntityCollection(DPSEC, WhereClause, PSCHRecordsPerBlock, SortExpr, DPStoDD);
RetVal = true;
}
for (int count = 0; count < DPSEC.Count; count++ )
{
/// checks if the DeviceData was really prefetched
if (DPSEC[count].DeviceData == null)
{
//// I put a break point on the next line and it breaks one in a while and not
//// on the first record, but sometimes it will pull 80 records and only one
//// will call this line.
RetVal = false;
}
}
return RetVal;
}
Please not the comment close the the RetVal = false.
Am I making a simple mistake and just not seen it? If not do you think upgrading to the latest version of llblgen pro would fix my issue. What would cause this to happen?
Please let me know,
God bless,
Bruno de França Valli