This project has moved. For the latest updates, please go here.

POST example

Jan 25, 2012 at 1:08 PM

The documentation mentions post isn't well tested. Is it working at all? Have you got a quick example of how to do a POST with WebLoadRequest?

Jan 25, 2012 at 4:39 PM

I'll whip one up, but I think it should just be something like:



public class MyDataLoader : IDataLoader<LoadContext> {

public virtual LoadRequest GetLoadRequest(LoadContext id, Type objectType) {

var wr = new WebLoadRequest(myLoadContext, "", "POST", "val1=a&val2=b");

wr.ContentType = "application/x-www-form-urlencoded";

return wr;



I think that should do a classic form post.  And I think some folks are using it, I know of a guy that's using AgFx in a read/write context, which I suspect does this.  He's a bit off the "core scenario" though in how he's using it.  In other words, using AgFx to both pull and push data to your server can get you in trouble if you're not careful.



Jan 25, 2012 at 4:45 PM

Yeah, that looks about right. I was trying one out but doing the byte encoding myself and passing that in as i didn't realize Agfx was doing it. After looking at the code I realized it should be the raw string. Of course now the POST service I was using has mysteriously vanished so need to find another one for testing.

There should be no reason to not use it for read/write you just need a different loader for each (and probably a different vm, almost a CQRS situation). Or am I missing something?