General information
Category:
The Mere Mortals .NET Framework
Here's the sequence of events that causes the problems:
AutoEmptyOnParentAdded = true (I've tried this with other child objects and it's consistent)
When ParentBizObj.NewRow() is called, the execution path includes:
mmBusinessObjectGeneric.StateChangeHandler(mmBaseBusinessObject bizObj, mmBusinessStateChangeEventArgs e)
When AutoEmptyOnParentAdded = true, GetEmptyEntityList() is called.
BusinessObjectHelperDS.GetEmptyEntityList[EntityType](string databaseKey, mmBusinessObjectGeneric[EntityType] businessObject)
When it calls GetEmptyDataSet(), it passes null for the dataset instead of the businessobject.DataSet - probably a very good reason.
mmBusinessObject.GetEmptyDataSet(DataSet ds, string tableName, string databaseKey)
When a null dataset is passed, the following code executes
ds = this.CreateDataSet();
this.SetCurrentDataSet(ds, tableName);
Thus, SetCurrentDataSet() is called without any DataTables defined. Later in GetEmptyDataSet(), GetEmptyDataTable() is called to create the DataTable, THEN SetCurrentDataSet() is called with a defined DataTable. It looks like the first call to SetCurrentDataSet() is an error and should be removed. I may be wrong (wouldn't be the first time, you can ask Kevin), but I don't see any scenarios where SetCurrentDataSet() belongs here.
mmBusinessObject.SetCurrentDataSet(DataSet ds, string tableName, bool setRequiredFields, bool raiseEvents, int rowNumber)
Executes and attempts to call CallStateChange() which calls...
mmBindingStrategyDataGrid.BindData(ImmBindingDataGrid mmGrid, DataSet ds, string tableName, mmBusinessObject bizObj)
which throws an error when setting the GridView.DataMember = tableName which is a table that does not exist in the dataset.
Answers to your questions:
I'm using WinForms.
oSalesDocument refers to a business object that is a composite of several business objects. The goal was to create a Business Document that contained the invoice, invoice items, customer... and all related information so I could combine the Business Logic to deal with a business document in one place. oSalesDocument.Invoices references the Invoices business object of the sales document.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only