Would you please help if it is possible, is there is a way to have generic way for load operation
For example: This is normal way to get Departments Data and bind it to grid
grid.ItemsSource = context.Departments;
LoadDepartmentsData();
private void LoadDepartmentsData()
{
EntityQuery<Department> query = context.GetDepartmentsQuery();
context.Load(query, LoadOperationIsCompleted, null);
}
private void LoadOperationIsCompleted(LoadOperation<Department> obj)
{
if (obj.HasError)
MessageBox.Show(obj.Error.Message);
}
So my question is it possible to have something like this?
grid.ItemsSource = context.Departments;
grid.ItemsSource = context.Departments;
LoadData(“GetDepartmentsQuery”);
private void LoadData(string queryName)
{
…..?
}
private void LoadOperationIsCompleted(LoadOperation obj)
{
if (obj.HasError)
MessageBox.Show(obj.Error.Message);
}
So I was wonder if there is a way to iterate the context queries in one method and compare it to the name of the query for example and then execute the load operation base on matched query as below
your help very appreciated
Best Regards,