I tried to add a form to my project with buttons to execute various queries and write the query results to the console. I noticed that none of the tutorials use forms as yet so I may be venturing into unimlemented territory but nothing ventured, nothing gained. The form code is as follows:
Public Class Form1
Private Shared aManager As DomainModel.Manager = New DomainModel.Manager()
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub
Private Sub Query01()
Dim query = aManager.Customers
For Each aCustomer As DomainModel.Customer In query
Console.WriteLine(aCustomer.CompanyName)
Next aCustomer
'Console.WriteLine()
' Console.WriteLine("Press ENTER to close window.")
'Console.ReadLine()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Query01()
End Sub
End Class
When I run tha app and click on Button1 I get Server Exception was Unhandled when the For Each statement is executed. The details of the exception is as follows:
IdeaBlade.EntityModel.v4.EntityServerException was unhandled
Cancelled=False
Message="Value cannot be null. Parameter name: key"
Source="IdeaBlade.EntityModel.v4"
StackTrace:
at IdeaBlade.EntityModel.v4.EntityManager.HandleEntityServerException(Exception pException, Boolean pTryToHandle, PersistenceOperation pOperation) at IdeaBlade.EntityModel.v4.EntityManager.ExecuteServerQuery(IEntityQuery pEntityQuery) at IdeaBlade.EntityModel.v4.EntityManager.ExecuteFetch(IEntityFinder finder) at IdeaBlade.EntityModel.v4.EntityQueryFinder.Execute() at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQueryCore(IEntityQuery query, QueryStrategy strategy) at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery query, QueryStrategy strategy, Boolean checkT) at IdeaBlade.EntityModel.v4.EntityManager.ExecuteQuery[T](IEntityQuery`1 query) at IdeaBlade.EntityModel.v4.EntityQuery`1.GetEnumerator() at DevForceEFTest2.Form1.Query01() in C:\Documents and Settings\Ron\My Documents\Visual Studio 2008\Projects\DevForceTest2\DevForceEFTest2\Form1.vb:line 16 at DevForceEFTest2.Form1.Button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Ron\My Documents\Visual Studio 2008\Projects\DevForceTest2\DevForceEFTest2\Form1.vb:line 25 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at DevForceEFTest2.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
InnerException: System.ArgumentNullException
Message="Value cannot be null. Parameter name: key"
ParamName="key"
Source="IdeaBlade.EntityModel.v4"
StackTrace:
at IdeaBlade.EntityModel.v4.EntityServerProxy.CheckConnection(Exception pException) at IdeaBlade.EntityModel.v4.EntityServerProxy.Fetch(SessionBundle pBundle, IEntityQuery pQuery) at IdeaBlade.EntityModel.v4.EntityManager.ExecuteServerQuery(IEntityQuery pEntityQuery)
InnerException: