Errors on EntityCollection after upgrade

Posts   
 
    
Posts: 42
Joined: 22-Jan-2007
# Posted on: 11-Sep-2007 09:46:16   

I have upgraded LLBLGen from 2.0 to 2.5 I am using JCL for the Business Layer (their newest 2.4 release which should be compatible with LLBLGen 2.5) Code generation was completed OK. But in my VB.NET application (which now refers to newest runtimes, DAL and BL) I get a whole bunch of errors which are all similar like this: Error 14 Value of type 'QBO.DAL.HelperClasses.EntityCollection(Of QBO.DAL.EntityClasses.XTArtEntity)' cannot be converted to 'QBO.DAL.HelperClasses.EntityCollection'. C:\QUESTORDOTNET\Questor2007\QN_COMM\clsQuorion2POS.vb 95 23 QN_COMM which refers to this piece of code (worked just fine before the upgrade): dim ecXTArt as EntityCollection ecXTArt = XTArtList.GetXTArtList(bucket)

Reported this to JCL and got the following reply from Bashar:

As for the errors, I understand that you are upgrading from LLBL 1 to 2, right? Because these errors your are facing are LLBL related and not JCL. However, for you info, there are 2 types of entity collections, one uses generics and the other does not. You cannot convert from one type to another. However, we have created a helper function that does a similar job.

I told him we upgraded from 2.0 to 2.5, but haven't heard from him since. There are 2 workarounds to solve the problem: 1) Declare the entitycollection like this: Dim ec As QBO.DAL.HelperClasses.EntityCollection(Of QBO.DAL.EntityClasses.XTArtEntity) ec = QBO.BL.ListClasses.XTArtList.GetXTArtList(Nothing)

2) Or use the JCL helperfunction: Dim ec As QBO.DAL.HelperClasses.EntityCollection ec=QBO.BL.Helpers.GenericEntityCollectionAsEntityCollection(QBO.BL.ListClasses.XTArtList.GetXTArtList(Nothing))

This means I have to scan through all the code to change the "GetList" calls cry Is this all due to a breaking change in 2.5 ? Or is it caused by JCL ?

Walaa avatar
Walaa
Support Team
Posts: 14995
Joined: 21-Aug-2005
# Posted on: 11-Sep-2007 11:41:03   

There was no breaking change related to your issue.

Error 14 Value of type 'QBO.DAL.HelperClasses.EntityCollection(Of QBO.DAL.EntityClasses.XTArtEntity)' cannot be converted to 'QBO.DAL.HelperClasses.EntityCollection'

The above error states that it can not convert from a Generic EntityCollection to a non-Generic one.

Generic entityCollections were introdiced in v.2.0, so nothing was changed in this part.Most probably the JCL method GetXTArtList, used to return a non Generic collection, and in the newer version it does return a Generic one. (You can go back to the older version of the JCL and check the return type of this method).

Anyway declaring the collection as a generic one as follows will be the solution to your problem:

Dim ec As QBO.DAL.HelperClasses.EntityCollection(Of QBO.DAL.EntityClasses.XTArtEntity)