BsonDefaults.cs 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /* Copyright 2010-2014 MongoDB Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. namespace MongoDB.Bson
  16. {
  17. /// <summary>
  18. /// A static helper class containing BSON defaults.
  19. /// </summary>
  20. public static class BsonDefaults
  21. {
  22. // private static fields
  23. private static GuidRepresentation __guidRepresentation = GuidRepresentation.CSharpLegacy;
  24. private static int __maxDocumentSize = int.MaxValue;
  25. private static int __maxSerializationDepth = 100;
  26. // public static properties
  27. /// <summary>
  28. /// Gets or sets the default representation to be used in serialization of
  29. /// Guids to the database.
  30. /// <seealso cref="MongoDB.Bson.GuidRepresentation"/>
  31. /// </summary>
  32. public static GuidRepresentation GuidRepresentation
  33. {
  34. get { return __guidRepresentation; }
  35. set { __guidRepresentation = value; }
  36. }
  37. /// <summary>
  38. /// Gets or sets the default max document size. The default is 4MiB.
  39. /// </summary>
  40. public static int MaxDocumentSize
  41. {
  42. get { return __maxDocumentSize; }
  43. set { __maxDocumentSize = value; }
  44. }
  45. /// <summary>
  46. /// Gets or sets the default max serialization depth (used to detect circular references during serialization). The default is 100.
  47. /// </summary>
  48. public static int MaxSerializationDepth
  49. {
  50. get { return __maxSerializationDepth; }
  51. set { __maxSerializationDepth = value; }
  52. }
  53. }
  54. }