I\'m currently applying the [BsonRepresentation(BsonType.String)]
attribute to all Guid
properties in my domain models to have those properties ser
This can be achieved using Conventions
Something along the lines of:
var myConventions = new ConventionProfile();
myConventions.SetSerializationOptionsConvention(
new TypeRepresentationSerializationOptionsConvention(typeof (Guid), BsonType.String));
BsonClassMap.RegisterConventions(myConventions, t => t == typeof (MyClass));
This should go somewhere in your app startup.
You can read more about conventions here: http://www.mongodb.org/display/DOCS/CSharp+Driver+Serialization+Tutorial#CSharpDriverSerializationTutorial-Conventions