I mimicked the deletion guard code in one of my business objects:
/// <summary>Get if allowed to delete this customer.</summary>
/// <remarks>Don't permit delete of customer with orders.</remarks>[Bindable(false)]
[BindingBrowsable(false)]
public override bool AllowDelete
{
get
{
if (SalesOrderMasters.Count > 0)
{ // has orders...do not delete
return false;
}return true;
}
}
Please note that the override throws an exception stating that there is nothing to override (in my CustomerMaster object?). If I remove the override, then it builds and the app runs. I did the same on another object. Here is the message I get when I click the delete button from the navigator:
"Are you sure that you want to delete 'MyCompany.MyNamespace.Model.MyObject'?"
Whoa! Scary! Not quite what I want to do. I will dig into the code a bit more to find out what is going on, but a quick response here from "someone in the know" would move things along.
So, two questions:
1) Do I need the override in the deletion guard code?
2) How are the strings handled in the actual delete code?
Thanks,
Bill
Edited by Linguinut - 12-Sep-2007 at 7:12pm