Print Page | Close Window

Complete "Select" Dynamic Query

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2010
Forum Discription: For .NET 4.0
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=3252
Printed Date: 13-May-2026 at 10:48am


Topic: Complete "Select" Dynamic Query
Posted By: k_cire0426
Subject: Complete "Select" Dynamic Query
Date Posted: 07-Feb-2012 at 9:59pm
hello,

       Is it really needed to call the Execute method when creating select dynamic query? I like to use the feature on EntityInstantFeedbackSource of DevExpress but I failed to do so. Is there a way to do that?

thanks...



Replies:
Posted By: sbelini
Date Posted: 08-Feb-2012 at 6:26pm
Hi k_cire0426,
 
You will need to cast your ITypedEntityQuery into an IQueryable:
 
  EntityInstantFeedbackSource efInstantFeedbackSource1 = new EntityInstantFeedbackSource();
  efInstantFeedbackSource1.KeyExpression = "LastName";
  efInstantFeedbackSource1.GetQueryable += efInstantFeedbackSource1_GetQueryable;
  gridControl1.ItemsSource = efInstantFeedbackSource1;
 
void efInstantFeedbackSource1_GetQueryable(object sender, GetQueryableEventArgs e) {
  NorthwindIBEntities mgr = new NorthwindIBEntities();
  IProjectionSelector selector = new ProjectionSelector("LastName");
  selector = selector.Combine("FirstName");
  var rootQuery = EntityQuery.Create(typeof(Employee), mgr);
  var query = rootQuery.Select(selector);
  e.QueryableSource = (IQueryable)query;
}
 
Regards,
   Silvio.


Posted By: k_cire0426
Date Posted: 08-Feb-2012 at 7:50pm
Hi sbelini,

Thank you for taking time looking into this. However, we exactly do the same but the data doesn't display. Can you confirm that the data is coming out on your grid? 

The weird part is when I didn't use the EntityInstantFeedbackSource and call the Execute method, I can see the data.

thanks..


Posted By: k_cire0426
Date Posted: 08-Feb-2012 at 9:11pm
hello sbelini,

Just an update here. I managed to make it work but have some catch.
1. The selector should have at least 1 primary/unique key field.
2. I have to fill in the "alias" optional parameter of ProjectionSelector.

I'm not sure if this bug or not and if it is a bug, is it on your side or DevExpress?

thanks..


Posted By: sbelini
Date Posted: 09-Feb-2012 at 10:51am
Hi k_cire0426,
 
Regarding your comments:
 
1. Yes, I needed to have a primary key field as well. This might be a DevExpress requirement/issue, since it's set on their EntityInstantFeedbackSource.
 
2. I didn't need to fill in the 'alias' optional parameter in our ProjectionSelector. (as in the snippet)
 
I'm attaching the test solution I tested with: uploads/892/T11495.zip - uploads/892/T11495.zip
 
Regards,
   Silvio.


Posted By: k_cire0426
Date Posted: 09-Feb-2012 at 2:59pm
Hello silvio,

Maybe you are right that it was a requirement to have a primary key...

thanks again..



Print Page | Close Window