I'm converting a DevForce classic application to DevForceEF. I'm new to the EF, Link, and DevForceEF so I'm having a problem understanding the upgrade and converting the code. For example here is some of my code:
private EntityList<LuActionType> mLuActionType;
private BindingList<Employee> mEmployeesBlank;
private EntityList<Employee> mEmployeesFilter;
private EntityList<Employee> mEmployees;
I've included the following references:
using IdeaBlade.EntityModel.v4;
using IdeaBlade.Util;
using DomainModel;
So, when declaring objects now it looks like I now have a choice of using a BindableList or BindingList. So, what is the difference and which one should I use?
USING A PASSTHRU. Here is my old code:
//-- using a passthru query
PassthruRdbQuery query = Employee.GetEmpoyeeDobByMonth(_currentmo.ToString());
query.QueryStrategy = QueryStrategy.DataSourceOnly;
mEmployees = mPersMgr.GetEntities<Employee>(query);
bsEmployee.DataSource = mEmployees;
I've now changed the bold line to:
mEmployees = (BindableList<Employee>) mPersMgr.ExecuteQuery(query);
Is this correct? It's the only way I could get it to compile because the BindableList isn't compatible with IEnumerable, I think.
USING A FILTER/PREDICATE
I've tried the following:
var filterCurrentEmployees = new Predicate<Employee>(delegate(Employee anEmployee) {
return anEmployee.Status.StatusCode == "C";
});
mEmployeesFilter.AddRange(mEmployees);
mEmployeesFilter.ListManager = new EntityListManager<Employee>(mPersMgr, filterCurrentEmployees, null);
BUT now I get an incompatibility with the EntityListManager and the ListManager!
I've looked through the examples and the developers guide but neither give me a full picture of how to do the conversions, nor do the uses of objects seem consistent between the examples. Any help would be appreciated.