Dit is veranderd, ik gebruik de nieuwste 1.x-driver (Nuget-pakket <package id="mongocsharpdriver" version="2.0.0" targetFramework="net45" />
) en in plaats van SetRepresentation
u stelt de serializer in.
public class RegistrationAttempt
{
public string AttemptId { get; set; }
}
BsonClassMap.RegisterClassMap<RegistrationAttempt>(cm =>
{
cm.AutoMap();
cm.MapIdProperty(c => c.AttemptId)
.SetIdGenerator(StringObjectIdGenerator.Instance)
.SetSerializer(new StringSerializer(BsonType.ObjectId));
});