8

When I call this:

BsonClassMap.RegisterClassMap<MyType>();

Under the covers the code calls this:

return RegisterClassMap<TClass>(cm => { cm.AutoMap(); });

And then it's off to mapping land.

I'm trying to figure out what rules are used when reflecting over the type to decide which fields and properties should be serialized/included in the map.

I've tried to reason-thru it by reading the code. I thought someone with more knowledge here could shortcut a full walk-thru in the debugger.

I'd specifically like to know the individual rules used to make a yes/no decision on a type member and the order in which those rules are applied.

Suraj
  • 35,905
  • 47
  • 139
  • 250
  • 1
    Had a browse around the docs and found this http://mongodb.github.io/mongo-csharp-driver/2.0/reference/bson/mapping/conventions/ it doesn't seem to expand on what the default conventions it adheres to are though – David Watts Sep 20 '17 at 15:10
  • 1
    The [`DefaultConventionPack`](https://github.com/mongodb/mongo-csharp-driver/blob/350adc845eae5bf3c4524788d11626c795d7c3e4/src/MongoDB.Bson/Serialization/Conventions/DefaultConventionPack.cs#L37) might be a good place to start. – Kirk Larkin Sep 25 '17 at 15:31
  • David, Kirk - thanks for the links. Because of the layers involved, I'm hoping someone already had the need to flatten-it-out just to be able to reason-thru the ruleset. – Suraj Sep 26 '17 at 13:37

0 Answers0