Value isn't of type boolean

Posts   
 
    
NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 13-Oct-2006 05:40:59   

LLBLGen 2.0 October 3 build, Adapter Single Class Runtime v2.0.0.61005 SqlServer2000

My code compiles fine, but during runtime, I get the following error:

Value isn't of type boolean

Stack

at SD.LLBLGen.Pro.TypeConverters.BooleanNumericConverter.ConvertTo(ITypeDescriptorContext context, CultureInfo culture, Object value, Type destinationType) at SD.LLBLGen.Pro.ORMSupportClasses.DbSpecificCreatorBase.GetRealValue(Object currentValue, TypeConverter typeConverterToUse, Type actualDotNetType) at SD.LLBLGen.Pro.DQE.SqlServer.SqlServerSpecificCreator.CreateParameter(IEntityFieldCore field, IFieldPersistenceInfo persistenceInfo, ParameterDirection direction, Object valueToSet) at SD.LLBLGen.Pro.ORMSupportClasses.FieldCompareValuePredicate.ToQueryText(Int32& uniqueMarker, Boolean inHavingClause) at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Int32& uniqueMarker, Boolean inHavingClause) at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Int32& uniqueMarker, Boolean inHavingClause) at SD.LLBLGen.Pro.ORMSupportClasses.PredicateExpression.ToQueryText(Int32& uniqueMarker) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Boolean relationsSpecified, Boolean sortClausesSpecified) at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause) at SD.LLBLGen.Pro.DQE.SqlServer.DynamicQueryEngine.CreatePagingSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DynamicQueryEngineBase.CreateSelectDQ(IEntityFieldCore[] selectList, IFieldPersistenceInfo[] fieldsPersistenceInfo, IDbConnection connectionToUse, IPredicate selectFilter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.CreateSelectDQ(IEntityFields2 fieldsToFetch, IFieldPersistenceInfo[] persistenceInfoObjects, IPredicateExpression filter, Int64 maxNumberOfItemsToReturn, ISortExpression sortClauses, IRelationCollection relationsToWalk, Boolean allowDuplicates, IGroupByCollection groupByClause, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollectionInternal(IEntityCollection2 collectionToFill, IRelationPredicateBucket& filterBucket, Int32 maxNumberOfItemsToReturn, ISortExpression sortClauses, Int32 pageNumber, Int32 pageSize) at SD.LLBLGen.Pro.ORMSupportClasses.DataAccessAdapterBase.FetchEntityCollection(IEntityCollection2 collectionToFill, IRelationPredicateBucket filterBucket, IPrefetchPath2 prefetchPath) at HLPUSD.QQest.BL.EmployeeManager.GetAllEmployees() in C:\Documents and Settings\NJDeVore\My Documents\Visual Studio 2005\Projects\HLPUSD.QQest.BL\EmployeeManager.cs:line 58 at NCSLeaderBoard.LeaderBoard.rgLeaderBoard_NeedDataSource(Object source, GridNeedDataSourceEventArgs e) in C:\Documents and Settings\NJDeVore\My Documents\Visual Studio 2005\Projects\NCSDev\NCSDev\LeaderBoard.aspx.cs:line 48 

It throws the error at the getConnection method inside of the FetchEntityCollection. I didn't attempt to debug into the ORMSupport dll. What should I look for? Obviously, it is looking for a boolean where there's not one. Does that mean I'm comparing a boolean column == 1 or something like that?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 13-Oct-2006 08:55:23   

Please post real code snippet.

Also state what type converters you are using, and on which fields. (if exists)

NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 13-Oct-2006 16:57:28   

When I call this method, it generates the error above:

public EntityCollection<EmpMainEntity> GetAllEmployees()
        {
            EntityCollection<EmpMainEntity> empList = new EntityCollection<EmpMainEntity>(new EmpMainEntityFactory());

            IRelationPredicateBucket empFilter = new RelationPredicateBucket();
            empFilter.PredicateExpression.Add(EmpMainFields.ActiveYn == 1);
            if (_departmentFilter.Length > 0)
                empFilter.PredicateExpression.AddWithAnd(new FieldCompareSetPredicate(EmpMainFields.DepartmentId,null,TblDepartmentFields.DepartmentId,null,SetOperator.In,(TblDepartmentFields.DepartmentId == _departmentFilter | TblDepartmentFields.ParentId == _departmentFilter)));
            IPrefetchPath2 empPrefetch = new PrefetchPath2((int)EntityType.EmpMainEntity);
            empPrefetch.Add(EmpMainEntity.PrefetchPathTimeWorkingPunch).Filter.Add(TimeWorkingPunchFields.InpunchDt == DateTime.Today).AddWithAnd(TimeWorkingPunchFields.ActiveYn == 1);
            empPrefetch.Add(EmpMainEntity.PrefetchPathUserLogin).SubPath.Add(UserLoginEntity.PrefetchPathUserRequestAbsence).Filter.Add(UserRequestAbsenceFields.AbsencestartDt >= DateTime.Today);
            empPrefetch.Add(EmpMainEntity.PrefetchPathEmpAbsenceUsed).Filter.Add(EmpAbsenceUsedFields.UsedDt >= DateTime.Today);

            using (DataAccessAdapter da = new DataAccessAdapter())
            {
                da.FetchEntityCollection(empList, empFilter, empPrefetch);
            }

            return empList;
        }

Something inside the FetchEntityCollection method is where the error is generated. I should point out that the ActiveYn field was previously set to a .NET boolean type using the type converter, but I've since removed all those conversions in this entity.

Do you want to see the generated code for the "EmpMain" entity as well?

--EDIT-- I also am going to include that I've got an unmapped field in the entity. I can't imagine that's part of the problem though.

bclubb
User
Posts: 934
Joined: 12-Feb-2004
# Posted on: 14-Oct-2006 02:29:27   

is it a new unmapped? And if so is it defined before any other mapped fields?

NickD
User
Posts: 224
Joined: 31-Jan-2005
# Posted on: 16-Oct-2006 16:25:41   

It is the fourth column in the table, but the only unmapped field I've got in that entity. It is a newly added field to the table, which I then promptly told the designer to unmap.

FYI - This database is from a third party so I've no control over it.

Jessynoo avatar
Jessynoo
Support Team
Posts: 296
Joined: 19-Aug-2004
# Posted on: 16-Oct-2006 17:23:22   

Heres is what throws the exception:

if(! (value is bool))
            {
                throw new ArgumentException("Value isn't of type boolean", "value");
            }

It's still expecting a Boolean, so the Type Convertion still exists. You should try clean and regenerate