Created
January 17, 2012 21:54
-
-
Save danielwertheim/1629176 to your computer and use it in GitHub Desktop.
Ano types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var r = session.Query<Photo>().ToEnumerableOfJson() | |
.Select(s => s.Deserialize(new { Votes = 0, User = "" })) //The call | |
.GroupBy(s => s.User).ToArray(); | |
//Ok, so the problem is that Votes and User doesn't get setters, right? But the have fields. | |
//E.g "<Votes>i__Field" which could be used | |
//Or perhaps the contract could be used to create a typed dictionary. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static T Deserialize<T>(this string json, T contract) | |
{ | |
return (T)JsonSerializer.DeserializeFromString(json, typeof(T)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note: this can be done outside of the serializer - just send it a type that has getters + setters.