RpcConnection

public abstract partial class RpcConnection {
	public bool Batched { get; set; } // allow combining requests in batches

	protected object Request(controller, action, arguments, returnType);
}

Description

It is the client part of the protocol "Ext Direct". You can create a new class based on the RpcConnection and use internal methods Request or Begin/End/AbortRequest to query remote server.

Code Sample

public class BlogClient : RpcConnection
{
	public BlogClient ()
		: base("http://example.com/Blog/Router") { }

	public string GetPost(int postId)
	{
		var controller = "Blog";
		var action = System.Reflection.MethodBase.GetCurrentMethod().Name;
		var arguments = new Dictionary<string, object> { { "postId", postId } };
		var returnType = typeof(Post);

		var result = base.Request(controller, action, arguments, returnType);

		return (Post)result;
	}
}

Last edited Apr 27, 2012 at 3:24 PM by ShaiHulud, version 2

Comments

No comments yet.