mauricioaniche / restfulie.net

.net version of restfulie server
http://restfulie.caelum.com.br
Other
50 stars 17 forks source link

Solved bug in MediaType chooser, Some refatoration, changed JsonSerializer #11

Closed AlbertoMonteiro closed 12 years ago

AlbertoMonteiro commented 12 years ago

MediaType bug solution

Some MediaType tests was broke, test was failing. I solved it. There was a problem on Convert.ToDouble that doesnt fixed eu-US culture for conversion. Regex also was improved

Changed JsonSerializer

Now using Newtosonft.Json, that is better than native. DateTime serialization now returns "new Date(value)" instead "/Date(value)/"

Refatoration

Change some Linq methods to improve performance, removed unused methods.

AlbertoMonteiro commented 12 years ago

Nenhum feedback ? ;/

mauricioaniche commented 12 years ago

feito, alberto! :)

dotnetchris commented 12 years ago

Was there a reason this pull request specifically uses

jsonSerializer.Converters.Add(new JavaScriptDateTimeConverter());

As opposed to

jsonSerializer.Converters.Add(new IsoDateTimeConverter());

I agree the standard JSON Date format sucks, but I don't understand the reasoning for accepting a nonstandard format that actually produces invalid json. Even dating back to 2009 http://james.newtonking.com/archive/2009/02/20/good-date-times-with-json-net.aspx "Technically this is invalid JSON according to the spec but all browsers, and some JSON frameworks including Json.NET, support it." jQuery 1.8 does not support this atleast.

I went with changing this to just use the default serialization options (rest of my site expects the dumb date format) and plugging in my own serializers which works for me. In regards to the overall project if you're going to use a custom date serialize the ISO one should be far more supported than this one.

I do have to say you have done some great work at how extensible Restfulie.net is and how easy it is for me to change such a key piece of this framework with so little code and definitely without having to crack open the source to do it. So many authors create software that I would've had to modify the source code manually to solve this.

AlbertoMonteiro commented 12 years ago

I agree 100% @dotnetchris. I will change this and make another pull request. Unfortunately JSON in my opnion was bad named(JavaScript Object Notation), Date is a object in JavaScript, but JSON is not JavaScript object notation, it is another object notation that doesnt support date type object. jQuery doesnt support it because it uses JSON.parse, and this doesnt understand nothing that is different from string, number, array and object.

mauricioaniche commented 12 years ago

Oh, btw, thanks for the compliment, Chris! :)