At some point in my application I need to find the employee using the value of his primary key ( I have that value of primary key ).
I tried something like:
bindingSource1.Position=bindingSource1.Find(“IdEmployee”, valueOfPrimaryKeyIKnowIt);
but bindingSource1.Find(“IdEmployee”, valueOfPrimaryKeyIKnowIt) returns -1.
I know how to get the independent Employee using:
PrimaryKey pk = new PrimaryKey(typeof(Employee), valueOfPrimaryKeyIKnowIt);
Employee anEmployee = MainPm.Manager.GetEntity<Employee>(pk, QueryStrategy.Normal);
But I don’t need an independent object; I need to keep in bindingSource1 all Employees but to be able to set current position to an Employee by his primary key.
Can you help me ?