New Posts New Posts RSS Feed: OnFetching Bug?
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

OnFetching Bug?

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

Joined: 12-Feb-2009
Posts: 12
Post Options Post Options   Quote francois Quote  Post ReplyReply Direct Link To This Post Topic: OnFetching Bug?
    Posted: 12-Feb-2010 at 12:36pm
Hi,
 
I'm trying to get the EntityManager for the current Query (e.Query.EntityManager) and it always return null. I want to use the DataSourceExtension to identify the current tenant so that I can "correct" the filter criteria. I don't know if it could be related to the fact that the call is done async from silverlight or something else. EntityManager.DefaultManager also does not work. It returns a EntityManager but for some reason it is always te wrong DataSourceExtention (seems cached or something, sometimes "" and sometimes the same as the default startup).
 
I checked on the client, it does not make a difference if I call Query.ExecuteAsync<T> or EntityManager.ExecuteQueryAsync<T>, both results in the server Query.EntityManager being null and the DataSourceExtention is 100% correct on the client.
 
Any Ideas?
 
Is there another way to get the EntityManager in the OnFetching server event.
 
Regards,
Francois
 
Back to Top
IdeaBlade View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 30-May-2007
Location: United States
Posts: 353
Post Options Post Options   Quote IdeaBlade Quote  Post ReplyReply Direct Link To This Post Posted: 15-Feb-2010 at 6:29pm
The DataSourceExtension isn't available in the server-side Fetching interceptor, but in the client-side Fetching event handler
you can assign it (or add it) to the query's tag:

void _mgr_Fetching(object sender, EntityFetchingEventArgs e) {
    e.Query.Tag = e.Query.EntityManager.DataSourceExtension;
}

That tag value will be available to you in the server-side interceptor:

class ServerFetching : IEntityServerFetching {
  public void OnFetching(EntityServerFetchingEventArgs args) {
    string tag = args.Query.Tag;
    . . .


Back to Top
francois View Drop Down
Newbie
Newbie
Avatar

Joined: 12-Feb-2009
Posts: 12
Post Options Post Options   Quote francois Quote  Post ReplyReply Direct Link To This Post Posted: 22-Feb-2010 at 12:39pm
Thank you
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down