mongodb/mongo-csharp-driver — pull request #70 by optimiz3 (2011-11-29 02:09:28+00:00)
Title: API Improvements

Contains the set of API improvements Robert and I discussed over email:

Commit 63e2d51e - Improve first-chance-exception debugging experience by factoring out …
Reason: Developers consuming the MongoDB CSharp driver with “break on first chance exception” enabled get many false breakpoints due to internal exceptions being thrown and caught which harms the development experience.

Commit 2256571c - Improve MongoUpdate and MongoInsert options to not need the class ins…
Reason: Collection operation option classes require the collection instance in order to initialize default values. This violates the API design best practice of not requiring a caller to provide something implicit to the current context. The collection instance is unnecessary as it is being provided to functions that are methods on the collection instance.

Commit f2925be2 - Unify IgnoreIfNull and SerializeDefaultValue into IgnoreIfDefault. nu…
Reason: The Ignore-If-Null semantic is a subset of Ignore-If-Default in .Net. The default for any reference type in .Net is always null; so and changing this to Ignore-If-Default makes the functionality more useful for value types without any additional API complexity.
Note: This merges the functionality of IgnoreIfNull and SerializeDefaultValue into IgnoreIfDefault. Doing this greatly simplifies the API as now a caller only has to specify IgnoreIfDefault rather than mixing and matching. [DefaultValue()] is functionality is preserved to enable the default value to be overridden however.

Have verified this passes all unit tests, and have also tested this against our development site.