Thank you for the reply, however, my question is really more general than that and isn't related to a specific error per se. Perhaps if I ask the question differently:
LLBLGen does not exposes the iAnywhere Transaction enumeration and forces us to use the System.Data.Isolation level enumeration which doesn't contain the correct values for Sybase. Is there any way to change this behavior?
By Default, when LLBLGen creates a transaction on it's own (all updates and deletes are put in a transaction by LLBLGen if not already included in one) it uses IsolationLevel.ReadCommitted. Is there anyway to change the behavior and make it use the correct IsolationLevel enumeration for Sybase and the one that we want?
We are using Sybase 11
ADO.NET version 11.0.1.22222
The updated code looks like this:
public void PostCalculationBatchSave(EmployeeEntity employee, EntityCollection<EmployeeTotalEntity> employeeTotals)
{
adapter.StartTransaction(IsolationLevel.ReadCommitted, "Doing batch delete/save after employee calculation");
try
{
DeleteEmployeeTotals(employee.EmployeeId);
DeleteEmployeeIntervals(employee.EmployeeId);
//save the employee entity along with his intervals
bool success = false;
IPredicateExpression concurrencyFilter = CreateConcurrencyFilter(employee);
if (concurrencyFilter != null)
success = adapter.SaveEntity(employee, false, concurrencyFilter);
else
success = adapter.SaveEntity(employee, false);
//save the employee totals
adapter.SaveEntityCollection(employeeTotals, false, false);
adapter.Commit();
}
catch (Exception ex)
{
adapter.Rollback();
throw DataExceptionFactory.CreateException(ex);
}
}
This is the code that is trying to fetch while the above transaction is in progress.
public EntityCollection<EmployeeEntity> FetchEmployeesForTimeCard(int payclassId, int payperiodId)
{
EntityCollection<EmployeeEntity> employees = new EntityCollection<EmployeeEntity>(new EmployeeEntityFactory());
IPrefetchPath2 prefetchPath = new PrefetchPath2((int)EntityType.EmployeeEntity);
//ISortExpression intervalSort = new SortExpression();
//intervalSort.Add(IntervalFields.CalculatedDay | SortOperator.Ascending);
PredicateExpression employeeFilter = new PredicateExpression();
employeeFilter.Add(EmployeeFields.PayclassId == payclassId);
PredicateExpression employeeTotalFilter = new PredicateExpression();
employeeTotalFilter.Add(EmployeeTotalFields.PayperiodId == payperiodId);
PredicateExpression approvedFilter = new PredicateExpression();
approvedFilter.Add(ApprovedEmployeeFields.PayPeriodId == payperiodId);
prefetchPath.Add(EmployeeEntity.PrefetchPathApprovedEmployee, Int32.MaxValue, approvedFilter);
RelationPredicateBucket bucket = new RelationPredicateBucket();
bucket.PredicateExpression.Add(employeeFilter);
//bucket.PredicateExpression.Add(employeeTotalFilter);
prefetchPath.Add(EmployeeEntity.PrefetchPathEmployeeTotals, Int32.MaxValue, employeeTotalFilter);
prefetchPath.Add(EmployeeEntity.PrefetchPathDepartment);
prefetchPath.Add(EmployeeEntity.PrefetchPathEmployeeTypes);
adapter.FetchEntityCollection(employees, bucket, Int32.MaxValue, null/*sort*/, prefetchPath);
return employees;
}
The errors are random and depend on somebody doing something at the same time. I can't generate them on demand per se, but we can set it up. I'm not at the office right now so I can't force an error but hope this gives enough to go on.
Thanks,
Allen