So far I haven't been able to successfully register a business object; it keeps telling me that the object instance is null. When I mouse over the object (see code snippet below), debug mode in VS2008, I see that this.Patient contains the structure of the Patient class, but no data. When I set up the DB connection, I tested it, so I know that the connection is valid.
Anyone have any ideas as to what I am doing wrong? I do not see anything in the examples that mention coding the HookConstructor() which is called when the business object is instantiated. Did I miss something? Are there any instructions out there that use WPF instead of WinForms?
The mm.net developer's guide is using a windows form app as an example to show how to register an object. They tell you to place the registraton code in the constructor so that the registration can occur before any data binding happens. However, the window1.xaml.cs file does not contain a constructor for Window1. And if you add one, it complains. There are two events that the XAML trigger when building the app: Initialize and Loaded. After doing some looking around, I ran finally came across the definitions for these two events: (
http://msdn.microsoft.com/en-us/library/ms754221.aspx). Based on these definitions it appears that the Initialize event handler is where the registration needs to occur. Is this correct?
private Patient Patient = new Patient();
private void mainWindow_Initialized(object sender, EventArgs e)
{
//Register business objects
this.Patient = (Patient)this.RegisterPrimaryBizObj(new Patient());
}
Thanks!
Lynn 8-)
Lynn Sim
Perot Systems Corp