First off, here's the standard requested information:
Designer Ver: 2.6 Final
Runtime Ver: 2.6.8.804
Template: Self-Servicing
Database: Sql Server 2008
I'm trying to define and retrieve a dynamic typed list at run time and have a null reference exception being thrown from the support classes DLL. I've confirmed that none of the values I'm passing are null, or contain null (besides the Transaction object I'm not using). Here is my definition of the view and releations.
Note - ReaderFields is class that simply stores constant field values so I don't have to reference reader[0].
var fields = new ResultsetFields(ReaderFields.FieldCount);
fields.DefineField(RootApplicationFields.RootApplicationId, ReaderFields.RootApplicationId);
fields.DefineField(RootApplicationFields.ApplicationRef, ReaderFields.ApplicationRef);
fields.DefineField(CriminalTxFields.CriminalTxId, ReaderFields.CriminalTxId);
fields.DefineField(CriminalApplicationFields.Created, ReaderFields.Created);
fields.DefineField(CriminalApplicationFields.CreatedBy, ReaderFields.CreatedBy);
fields.DefineField(CriminalApplicationFields.LastModified, ReaderFields.LastModifed);
fields.DefineField(CriminalApplicationFields.LastModifiedBy, ReaderFields.LastModifiedBy);
fields.DefineField(CriminalApplicationFields.CriminalApplicationId, ReaderFields.CriminalApplicationId);
var joins = new RelationCollection();
joins.Add(RootApplicationEntity.Relations.CriminalApplicationEntityUsingCriminalApplicationId);
joins.Add(CriminalApplicationEntity.Relations.CriminalTxEntityUsingCriminalApplicationId);
var ipe = new PredicateExpression(RootApplicationFields.CustOrgUnitId == orgUnitId);
ipe.AddWithAnd(RootApplicationFields.Created > DateTime.Now.AddYears(-2));
var dao = new TypedListDAO();
using (IDataReader reader = dao.GetAsDataReader(null, fields, ipe, joins, CommandBehavior.CloseConnection, 0, false))
And now the stack trace for the exception:
System.NullReferenceException was unhandled by user code
Message="Object reference not set to an instance of an object."
Source="SD.LLBLGen.Pro.ORMSupportClasses.NET20"
StackTrace:
at SD.LLBLGen.Pro.ORMSupportClasses.PersistenceCore.AddInheritanceRelatedElementsToQueryElementsForDynamicList(InheritanceHierarchyType hierarchyType, IList fields, IPredicateExpression filter, IRelationCollection relations, IInheritanceInfoProvider infoProvider, String forEntityName)
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.CreateQueryFromElements(ITransaction transactionToUse, IEntityFields fields, IPredicate filter, IRelationCollection relations, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetAsDataReader(ITransaction transactionToUse, IEntityFields fields, IPredicate filter, IRelationCollection relations, CommandBehavior readerBehavior, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, IGroupByCollection groupByClause, Boolean allowDuplicates, Int32 pageNumber, Int32 pageSize)
at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetAsDataReader(ITransaction transactionToUse, IEntityFields fields, IPredicate filter, IRelationCollection relations, CommandBehavior readerBehavior, Int32 maxNumberOfItemsToReturn, Boolean allowDuplicates)
at CRMoveCustomer.Converters.CriminalApplicationConverter.ConvertCriminalApplications(Int32 orgUnitId) in D:\projects\cr6\CRMoveCustomer\CRMoveCustomer\Converters\CriminalApplicationConverter.cs:line 64
at CRMoveCustomer.ConvertCustomer.ProcessApplications() in D:\projects\cr6\CRMoveCustomer\CRMoveCustomer\ConvertCustomer.cs:line 117
at CRMoveCustomer.Form1.ApplicationWorkerDoWork(Object sender, DoWorkEventArgs e) in D:\projects\cr6\CRMoveCustomer\CRMoveCustomer\Form1.cs:line 91
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)
InnerException:
Any suggestions would be greatly appreciated, I've been searching around and can't find anything that seems to indicate what is causing this exception. If any additional information would be beneficial, please let me know and I'll post whatever is required.
Thanks for reading!