I have a BusinessList Base class 'Roster' which has a factory method "FetchAll". I am databinding this to a listbox using an ObjectDataProvider
<ObjectDataProvider x:Key="roster" ObjectType="bo:Roster" MethodName="FetchAll"/>
I have a button for deleting an item from the list. In the code behind how do I get access to the object returned from the factory method?
_roster = (Roster)(FindResource("roster") as ObjectDataProvider).ObjectInstance;
but it return a emply collection?
You should consider using CslaDataProvider, as it understands the static factory method model recommended for CSLA objects. I don't think the ObjectDataProvider works? I know it didn't work originally, though perhaps Microsoft changed something in .NET 3.5.
Even so, the CslaDataProvider includes other CSLA-specific features and functionality that you'll almost certainly find useful.
Copyright (c) Marimer LLC