prefetchPath2 Ctor

Posts   
 
    
Rosacek
User
Posts: 155
Joined: 18-Mar-2012
# Posted on: 22-Jun-2012 09:31:14   

Hi, I am trying to start using prefetch path (Adapter, LLBL 3.5).

In the manual there is simple example beginning with: ' VB.NET Dim orders As New EntityCollection(Of OrderEntity)() Dim prefetchPath As New PrefetchPath2(EntityType.OrderEntity) ....

But I got an error in this statement: Overload resolution failed because no accessible 'New' is most specific for these arguments: 'Public Sub New(rootEntityType As System.Enum)': Not most specific. 'Public Sub New(rootEntityType As Integer)': Not most specific.

To get rid of I have to cast to INT like: Dim prefetchPath As New PrefetchPath2(Ctype(EntityType.OrderEntity,Integer))

But there is no cast to INT in your example in the manual, why? Mistake in doc or did I miss something? Thx.

Walaa avatar
Walaa
Support Team
Posts: 14946
Joined: 21-Aug-2005
# Posted on: 22-Jun-2012 11:20:26   

Good catch, I think we need to fix the docs.

Otis avatar
Otis
LLBLGen Pro Team
Posts: 39588
Joined: 17-Aug-2003
# Posted on: 22-Jun-2012 12:11:25   

VB.NET specific issue. The thing is: the VB.NET compiler is too stupid to pick the right overload. Because the C# variant:

PrefetchPath2 prefetchPath = new PrefetchPath2(EntityType.OrderEntity);

works fine, because the compiler can pick the right ctor. Too bad you have to insert the CInt() cast... disappointed The VB.NET compiler never stops to amaze me how confused it can get.

We'll correct the docs of course.

Frans Bouma | Lead developer LLBLGen Pro