You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// Represents a BSON serialization provider which defines that some serializable types should be treated
9
+
/// as BSON class maps.
10
+
/// </summary>
11
+
/// <remarks>
12
+
/// Argumented types to be forced as BSON class maps can be either concrete or also base class and interface ones.
13
+
///
14
+
/// This serialization provider is useful when a class may implement a collection interface (for example, <see cref="System.Collections.Generic.IList{T}"/>)
15
+
/// because the domain requires the class to act as a collection, but in terms of serialization, it must be serialized as a regular
16
+
/// POCO class.
17
+
/// </remarks>
18
+
/// <example>
19
+
/// For example, given the following class:
20
+
///
21
+
/// <code language="c#">
22
+
/// public interface ISomeInterface { }
23
+
/// public class SomeImpl : ISomeInterface { }
24
+
/// </code>
25
+
///
26
+
/// This provider can be configured both to force any <codeInline>SomeImpl</codeInline> to be treated as
27
+
/// BSON class map and also any implementation of <codeInline>ISomeInterface</codeInline> can be configured as a
28
+
/// forced type to let any implementation be serialized as a BSON class map:
29
+
///
30
+
/// <code language="c#">
31
+
/// ForceAsBsonClassMapSerializationProvider provider = new ForceAsBsonClassMapSerializationProvider(typeof(SomeImpl));
32
+
///
33
+
/// // or
34
+
///
35
+
/// ForceAsBsonClassMapSerializationProvider provider = new ForceAsBsonClassMapSerializationProvider(typeof(ISomeInterface));
36
+
///
37
+
/// // or even both
38
+
///
39
+
/// ForceAsBsonClassMapSerializationProvider provider = new ForceAsBsonClassMapSerializationProvider(typeof(SomeImpl), typeof(ISomeInterface));
thrownewArgumentException("Cannot configure a forced BSON class map serialization provider which contains no types to be forced as BSON class maps","forcedTypes");
0 commit comments