Why my implementation of InterLinqQueryHandler never return to the client ?

Aug 14, 2009 at 9:36 AM

 

public class ObjectQueryHandler2 : InterLinqQueryHandler
{
IEnumerable<String> _Coll;
public ObjectQueryHandler2(IEnumerable<String> collection)
{
_Coll = collection;
}
public override IQueryProvider QueryProvider
{
get
{
return _Coll.AsQueryable().Provider;
}
}
}
static void Main(string[] args)
{
List<String> persons = new List<string>()
{
"titi",
"toto",
"tata"
};
IQueryHandler queryHandler = new ObjectQueryHandler2(persons);
// Publish the service
using(ServerQueryWcfHandler serverQueryHandler = new ServerQueryWcfHandler(queryHandler))
{
serverQueryHandler.Start(new WSHttpBinding(), "http://localhost:8743/");
Console.WriteLine("listening");
Console.ReadLine();
}
}

This implementation should just behave as a classic ObjectQueryHandler :

public class ObjectQueryHandler2 : InterLinqQueryHandler
{
	IEnumerable<String> _Coll;
	public ObjectQueryHandler2(IEnumerable<String> collection)
	{
		_Coll = collection;
	}
	public override IQueryProvider QueryProvider
	{
		get
		{
			return _Coll.AsQueryable().Provider;
		}
	}
}

But my service never return in my client when I do that, altough this work :

 

class ObjectQueryHandler : IQueryHandler
{
	IEnumerable<String> _Collection;
	public ObjectQueryHandler(IEnumerable<String> collection)
	{
		_Collection = collection;
	}
	#region IQueryHandler Members

	public bool CloseSession()
	{
		return true;
	}

	public IQueryable<T> Get<T>() where T : class
	{
		return (IQueryable<T>)Get(typeof(T));
	}

	public IQueryable Get(Type type)
	{
		return _Collection.AsQueryable();
	}

	public IQueryable GetTable(Type type)
	{
		return Get(type);
	}

	public IQueryable<T> GetTable<T>() where T : class
	{
		return (IQueryable<T>)GetTable(typeof(T));
	}

	public bool StartSession()
	{
		return true;
	}

	#endregion



}

What is incorrect in my implementation of InterLinqQueryHandler ?

Thanks in advance for you responses,

Happy coding,

 

 

 

Coordinator
Aug 14, 2009 at 10:40 AM

Hi

You're inheriting from a wrong class. InterLinqQueryHandler is ment to be a base class for the query handler on the client side.
Just use your second solution on the server side. Maybe the InterLinqQueryHandler should be renamed to prevent confusions.

Kind regards

Pascal