MVVM-S and VB.Net?

Mar 23, 2011 at 9:57 AM

Hi, im trying to setup your project in VB.net, but when i try to use contextmanager.LoadQuery(...), VS complains about:

Error 4 'LoadData' is ambiguous because multiple kinds of members with this name exist in class 'SL.MVVMS.RIA.ContextManager'.

is it possible to use your toolkit with VB and is there some kind of workaround?

Thanks!

Kivi

Mar 23, 2011 at 12:40 PM

sorry it is contextmanger.LoadData(...)..

Coordinator
Mar 23, 2011 at 5:57 PM

LoadData is an overloaded method for sure - but that should not be an issue for VB.net.  I would recommend checking the namespaces you are importing, and try referencing the class directly using the full namespace.  Can you post the imports part of the file causing you the issue, and the function where you are experiencing this issue?  That would help me figure out what your problem is.

Mar 23, 2011 at 7:50 PM

Hi, rposener! thanks for reply,

this is in service template:

IImports System.Linq

Imports System.Collections.Generic

Imports System.ComponentModel

Imports System.Windows

Imports SL.MVVMS.RIA

Imports System.ServiceModel.DomainServices.Client

'Imports BusinessApplication4.Web.Service

'Namespace BusinessApplication4

 

i had to comment last two lines cause they caused errors in template, and "ambiguos" error is in load data region, when i type "contextmanager." intellisense shows other functions but there is no "LoadData"..

Public Sub SimpleLoadExample(callback As Action)        

If domainContext Is Nothing Then            

callback()            

Return        

End If

Dim query = domainContext.GetRASQuery()        ' The callback occurs OnLoadComplete        

contextManager.LoadData(query, OnLoadComplete:=callback, ProcessDeletes:=True)    

 End Sub

friend of mine check your source code and he think that "equals" sign (and default parameters) confuses VB.net in LoadData function:

public LoadOperation LoadData(EntityQuery Query, LoadBehavior Behavior = LoadBehavior.KeepCurrent, Action OnLoadComplete = null, bool ProcessDeletes = false, Func<DeleteEventArgs, bool> DeleteFilter = null)

well im still newbie, so im not good to talk.. :)  if you want i can send you my entire solution, it is just test example..

Kivi


Coordinator
Mar 23, 2011 at 10:41 PM

I can't say for certain, but it does appear that you are correct - VB does not seem to handle overloaded methods which provide a similar function to a method with default parameters, which I assume it must consider as optional parameters.

I am starting to work on some updates with the latest RIA updates that came out.  I will get this fixed then.

In the meantime, you can either use C# or you can download the source code and fix it and compile the toolkit yourself.  Just remove all the other overloaded methods, leaving only the method with the actual implementation.

Mar 24, 2011 at 11:39 AM

hi,

i've done that and it seems to work!

thank you! 

Kivi