Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4
What sample should I use as the best guide for learning an N-Tier application using CSLA.NET and a WinForm
Is there anything that is the same size as Project Tracker, but works?
Because Windows Forms hasn't changed in many years, you don't need a current sample to see how it works. The best sample is the version 3.6 or 3.7 ProjectTracker application.
Though you'll want to look at the 4.2 ProjectTracker to see how the business classes are put together.
The one thing to keep in mind, new with CSLA 4, is that you need to use the "BindingList" collection base classes. So BusinessBindingListBase instead of BusinessListBase. Those "BindingList" types exist to support Windows Forms, because Windows Forms data binding (having not changed for years) requires the older collection type, and won't work with the newer collection type.
In that case, I guess my question is different. I am completely new to CSLA and just trying to get my feet wet. When I try to run the Project Tracker from CslaSamples-4.1.0-110118.zip, I get the stack trace below. When I searched the forum as to the reason why, I was left with the impression it doesn't work right now. Can you confirm, the WinForm in ProjectTracker should be working?
{"DataPortal.Fetch failed (Invalid operation - fetch not allowed)"}
at Csla.ReadOnlyBase`1.DataPortal_Fetch(Object criteria)
at lambda_method(Closure , Object , Object[] )
at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
at Csla.Reflection.MethodCaller.CallMethod(Object obj, DynamicMethodHandle methodHandle, Object[] parameters)
at Csla.Reflection.MethodCaller.CallMethod(Object obj, String method, Object[] parameters)
at Csla.Reflection.LateBoundObject.CallMethod(String method, Object[] parameters)
at Csla.Server.SimpleDataPortal.Fetch(Type objectType, Object criteria, DataPortalContext context)
at Csla.DataPortal.Fetch(Type objectType, Object criteria)
at Csla.DataPortal.Fetch[T](Object criteria)
at ProjectTracker.Library.Security.PTIdentity.GetIdentity(String username, String password) in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\ProjectTracker.Library\Security\PTIdentity.cs:line 28
at ProjectTracker.Library.Security.PTPrincipal.Login(String username, String password) in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\ProjectTracker.Library\Security\PTPrincipal.cs:line 31
at PTWin.LoginForm.OK_Click(Object sender, EventArgs e) in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\PTWin\LoginForm.cs:line 23
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.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(IntPtr 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.Form.ShowDialog(IWin32Window owner)
at PTWin.MainForm.DoLogin() in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\PTWin\MainForm.cs:line 327
at PTWin.MainForm.LoginToolStripButton_Click(Object sender, EventArgs e) in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\PTWin\MainForm.cs:line 317
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.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(IntPtr 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 PTWin.Program.Main() in C:\Shared\CSLA\Samples-4.1.0-110118\Samples\NET\cs\ProjectTrackercs\PTWin\Program.cs:line 17
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
The 3.6 or 3.7 version of ProjectTracker should be used as a Windows Forms example.
The 4.2 version (currently in svn, or included with the ebooks) shows how to create CSLA 4 business classes, but doesn't include a Windows Forms UI.
The 4.0 and 4.1 versions of ProjectTracker do not work.
Copyright (c) Marimer LLC