New Posts New Posts RSS Feed: Complete "Select" Dynamic Query
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

Complete "Select" Dynamic Query

 Post Reply Post Reply
Author
k_cire0426 View Drop Down
Newbie
Newbie
Avatar

Joined: 21-Jan-2012
Posts: 12
Post Options Post Options   Quote k_cire0426 Quote  Post ReplyReply Direct Link To This Post Topic: Complete "Select" Dynamic Query
    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...
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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.


Edited by sbelini - 08-Feb-2012 at 6:53pm
Back to Top
k_cire0426 View Drop Down
Newbie
Newbie
Avatar

Joined: 21-Jan-2012
Posts: 12
Post Options Post Options   Quote k_cire0426 Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
k_cire0426 View Drop Down
Newbie
Newbie
Avatar

Joined: 21-Jan-2012
Posts: 12
Post Options Post Options   Quote k_cire0426 Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
sbelini View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 13-Aug-2010
Location: Oakland
Posts: 786
Post Options Post Options   Quote sbelini Quote  Post ReplyReply Direct Link To This Post 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
 
Regards,
   Silvio.
Back to Top
k_cire0426 View Drop Down
Newbie
Newbie
Avatar

Joined: 21-Jan-2012
Posts: 12
Post Options Post Options   Quote k_cire0426 Quote  Post ReplyReply Direct Link To This Post 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..
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down