Print Page | Close Window

OnFetching Bug?

Printed From: IdeaBlade
Category: DevForce
Forum Name: DevForce 2009
Forum Discription: For .NET 3.5
URL: http://www.ideablade.com/forum/forum_posts.asp?TID=1643
Printed Date: 21-Apr-2025 at 2:21pm


Topic: OnFetching Bug?
Posted By: francois
Subject: OnFetching Bug?
Date 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
 



Replies:
Posted By: IdeaBlade
Date 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;
    . . .




Posted By: francois
Date Posted: 22-Feb-2010 at 12:39pm
Thank you



Print Page | Close Window