Permalink
Browse files

Merge branch 'bson-serializer-86'

  • Loading branch information...
2 parents 745c60d + 5b81de3 commit 4b8c69311205d173204efa1e6fc53d3c4d234696 Oliver, Jonathan committed Nov 1, 2011
@@ -17,12 +17,13 @@ public BsonSerializer(params Type[] knownTypes)
public override void Serialize<T>(Stream output, T graph)
{
- this.Serialize(new BsonWriter(output), graph);
+ var writer = new BsonWriter(output) { DateTimeKindHandling = DateTimeKind.Utc };
+ this.Serialize(writer, graph);
}
public override T Deserialize<T>(Stream input)
{
- return this.Deserialize<T>(new BsonReader(
- input, IsArray(typeof(T)), DateTimeKind.Unspecified));
+ var reader = new BsonReader(input, IsArray(typeof(T)), DateTimeKind.Utc);
+ return this.Deserialize<T>(reader);
}
private static bool IsArray(Type type)
{
@@ -14,7 +14,7 @@ public static SimpleMessage Populate(this SimpleMessage message)
{
Id = Guid.NewGuid(),
Count = 1234,
- Created = new DateTime(2000, 2, 3, 4, 5, 6, 7),
+ Created = new DateTime(2000, 2, 3, 4, 5, 6, 7).ToUniversalTime(),
Value = message.Value + "Hello, World!",
Contents = { "a", null, string.Empty, "d" }
};

0 comments on commit 4b8c693

Please sign in to comment.