I am having a random failure in a query. The table that is being queried is not changing during my usage. I can't categorically say this is the issue, but I ran 6700 processes (each calling this once) without this failing. In the next 600 runs, I've had this failure about 80 times. If I re-run the same test, it nearly always succeeds.
LLBLGen version: 2.6 Final (October 9th, 2009)
Runtime version: 2.6.09.1202
Using Adaptor on .Net4
Database is Postgres 8.3, Npgsql v 2.0.6.0
System.InvalidCastException: Unable to cast object of type 'System.Int32' to type 'System.String'.
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ReadRowIntoFields(Object[] values, IEntityFields2 rowDestination, List1 fieldIndexToOrdinal, IFieldPersistenceInfo[] fieldsPersistenceInfo)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateEntityInstanceFromReaderRow(IEntityFactory2 entityFactory, IFieldPersistenceInfo[] fieldsPersistenceInfo, Int32 numberOfFieldsInQuery, InheritanceHierarchyType typeOfHierarchy, Dictionary
2 hierarchyFieldAliasesToOrdinals, List1 fieldIndexToOrdinal, Dictionary
2 entityFieldStartIndexesPerEntity, Boolean hasExcludedFields, IFieldPersistenceInfo[] persistenceInfosForRowReader, Object[] valuesOfRow, IEntityFactory2& entityFactoryToUse)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.ExecuteMultiRowRetrievalQuery(IRetrievalQuery queryToExecute, IEntityFactory2 entityFactory, IEntityCollection2 collectionToFill, IFieldPersistenceInfo[] fieldsPersistenceInfo, Boolean allowDuplicates, IEntityFields2 fieldsUsedForQuery)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal(IEntityCollection2 collectionToFill, IRelationPredicateBucket& filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize)
at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IPrefetchPath2 prefetchPath, ExcludeIncludeFieldsList excludedIncludedFields, Int32 pageNumber, Int32 pageSize)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider2.ExecuteEntityProjection(QueryExpression toExecute)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.ExecuteExpression(Expression handledExpression)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.Execute(Expression expression)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProviderBase.System.Linq.IQueryProvider.Execute(Expression expression)
at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery`1.SD.LLBLGen.Pro.LinqSupportClasses.ILLBLGenProQuery.ExecuteTResult
at Zetec.Analysis.QueryHelper.GetOutages(String exclude_me)
<snip the rest of my callstack>
The call to GetOutages is being passed "ONS2_EOC24_Revo_Reso"
//exclude_me is for the current outage, if you don't want it
public static EntityCollection<OutageEntity> GetOutages(string exclude_me)
{
EntityCollection<OutageEntity> ret;
using (DataAccessAdapter adapter = Create.Adapter())
{
LinqMetaData metaData = new LinqMetaData(adapter);
if (string.IsNullOrEmpty(exclude_me))
{
ret =
((ILLBLGenProQuery)from o in metaData.Outage
orderby o.InspectionDate descending
select o).Execute<EntityCollection<OutageEntity>>();
}
else
{
ret =
((ILLBLGenProQuery)from o in metaData.Outage
where o.Name != exclude_me
orderby o.InspectionDate descending
select o).Execute<EntityCollection<OutageEntity>>();
}
}
return ret;
}
CREATE TABLE outages (
name text PRIMARY KEY, --if we update the name of the outage, those entries referencing it should get their entry updated - llbl instructions http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=630
number int2 NOT NULL,-- the number of the outage because we can't count on the dates
inspection_date date,
comment text
);
Contents of outages table:
"EOC24 - 04/09";5;"2009-04-30";"Imported From HMS"
"ONS2_EOC24_Revo_Reso";9999;"2010-08-09";"Created by analysis since it didn't already exist"
"ONS3_EOC25_Revo";9999;"2010-10-27";"Created by analysis since it didn't already exist"