Outer Join Error: Conversion from a value of type 'System.DBNull' to 'System.Boolean' isn't supported

Posts   
 
    
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 11:29:18   

Hello,

Using this outer join technique with DefaultIfEmpty we get an error if the table that is not mandatory has a boolean field: var poolsAndAdmins = (from pool in _metaData.Pool join iplanUser in _metaData.IplanUser on pool.AdminIplanUserId equals iplanUser.Id into adminUsers from adminUser in adminUsers.DefaultIfEmpty() select adminUser.IsPhotoShown).ToList();

We are using version 4.1 Final (March 12th, 2014) and Oracle (ODP.NET). If we do "select adminUser" it also fails, if we select all fields except this boolean field it works.

Regards,

Alexander.

Stacktrace: at SD.LLBLGen.Pro.ORMSupportClasses.BooleanNumericConverter.PerformConvertFrom(Object value) at SD.LLBLGen.Pro.ORMSupportClasses.SystemTypeConverterBase1.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value) at SD.LLBLGen.Pro.ORMSupportClasses.ProjectionUtils.FetchProjectionFromReader(List1 valueProjectors, IGeneralDataProjector projector, IDataReader datasource, Int32 rowsToSkip, Int32 rowsToTake, Boolean clientSideLimitation, Boolean clientSideDistinctFiltering, Boolean clientSidePaging, UniqueList1 stringCache, Dictionary2 typeConvertersToRun, IRetrievalQuery queryExecuted) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetAsProjection(List1 valueProjectors, IGeneralDataProjector projector, ITransaction transactionToUse, IRetrievalQuery queryToExecute, Dictionary2 typeConvertersToRun) at SD.LLBLGen.Pro.ORMSupportClasses.DaoBase.GetAsProjection(List1 valueProjectors, IGeneralDataProjector projector, ITransaction transactionToUse, QueryParameters parameters) at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProProvider.ExecuteValueListProjection(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.LLBLGenProQuery1.Execute() at SD.LLBLGen.Pro.LinqSupportClasses.LLBLGenProQuery1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at IPlan.ServiceContracts.PoolService.GetPoolListAndAdminDataList(List1& poolDataList, List1& adminDataList, Int64 opCoIdIn, AuthenticationInfo authenticationInfo, ErrorInfo& errorInfo) in c:\Code\trunk\BusinessLogicService\ServiceContracts\Implementation\PoolService.cs:line 267

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Jul-2014 11:47:12   

Please download the latest build, it looks like a bug that was fixed on June 25th, 2014

Frans Bouma | Lead developer LLBLGen Pro
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 12:20:49   

Thanks for the quick response. I already looked through the changelog, and this change attracted my attention, but it was not clear for me if it was related. I will try the new version and if it works we're gonna upgrade in september. This holiday period isn't the right time to upgrade and we already have a workaround.

I will let you know.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Jul-2014 12:34:17   

AlexanderM wrote:

Thanks for the quick response. I already looked through the changelog, and this change attracted my attention, but it was not clear for me if it was related. I will try the new version and if it works we're gonna upgrade in september. This holiday period isn't the right time to upgrade and we already have a workaround.

I will let you know.

Checking the change made on june 25th, it's indeed not the same, as the fix there was made in the datavalueprojector, however your situation ends up not using datavalueprojectors which are pre-set to typeconverters as they're from the linq provider and that doesn't know about type converters.

We'll fix it.

Frans Bouma | Lead developer LLBLGen Pro
Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Jul-2014 13:36:07   

Fixed in next v4.1 build. (uploaded later today)

Frans Bouma | Lead developer LLBLGen Pro
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 14:04:12   

Thanks,

I just tested with the old-new build and indeed still an error, though a bit different.

Object cannot be cast from DBNull to other types.

I will wait untill the new buld is ready.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Jul-2014 14:41:22   

Interesting the error is different...

I've attached the 4.1 fixed build.

Frans Bouma | Lead developer LLBLGen Pro
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 14:51:28   

I can't compile anymore, 2 overrides in EntityFactories.cs give a message 'no suitable method found to override'

    public override IDynamicRelation CreateDynamicRelation(IEntityFieldCore leftOperand, JoinHint joinType, DerivedTableDefinition rightOperand, string aliasLeftOperand, IPredicate onClause)

    public override IDynamicRelation CreateDynamicRelation(IEntityFieldCore leftOperand, JoinHint joinType, string rightOperandEntityName, string aliasLeftOperand, string aliasRightOperand, IPredicate onClause)
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 14:58:19   

You say 4.1 fixed build. I already have 4.2 installed, should I go back to 4.1 or can you make a 4.2 fixed build or is it something else?

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39614
Joined: 17-Aug-2003
# Posted on: 25-Jul-2014 15:01:38   

AlexanderM wrote:

You say 4.1 fixed build. I already have 4.2 installed, should I go back to 4.1 or can you make a 4.2 fixed build or is it something else?

Oh I attached v4.1 as you referred in your start post you were using v4.1. I've attached v4.2 runtimes to this post.

Frans Bouma | Lead developer LLBLGen Pro
AlexanderM
User
Posts: 41
Joined: 18-May-2012
# Posted on: 25-Jul-2014 16:07:15   

It works,

Thanks. wink