I'm trying to pass an object from client to hub: On client:
connection.invoke('MyMethod', {
i: 1,
a: 25
});
On hub:
public async Task MyMethod(TestModel model)
{
// logic
}
Model:
public class TestModel
{
[JsonProperty("i")]
public double Min {get;set;}
[JsonProperty("a")]
public double Max {get;set;}
}
In the MyMethod the model is not null, but the values are always 0.
What I'm doing wrong?
JsonPropertyattribute is used when you're serializing theTestModelnot binding it with json according to Newtonsoft docs. Did you try naming theTestModelfieldsiandaas a test?