Source/NFX/Serialization/BSON/RowConverter.cs
/// <summary>
/// Converts CLR value to BSON. The following values are supported:
///   primitives+scaled decimal, enums, TypedRows, GDID, Guid, Amount, IDictionary, IEnumerable (including arrays).
/// If conversion could not be made then exception is thrown
/// </summary>
Converts CLR value to BSON. The following values are supported:
primitives+scaled decimal, enums, TypedRows, GDID, Guid, Amount, IDictionary, IEnumerable (including arrays).
If conversion could not be made then exception is thrown
Converts CLR value to BSON . The following values are supported : primitives + scaled decimal enums TypedRows GDID Guid Amount IDictionary IEnumerable ( including arrays ) . If conversion could not be made then exception is thrown
public BSONElement ConvertCLRtoBSON(string fieldName, object data, string targetName)
      {
        if (data==null) return fieldName != null ? new BSONNullElement(fieldName) : new BSONNullElement();
        var tp = data.GetType();
        if (tp.IsValueType)
          return DoConvertCLRtoBSON(fieldName, data, tp, targetName);
        if (ts_References==null)
            ts_References = new HashSet<object>(NFX.ReferenceEqualityComparer<object>.Instance);
        if (ts_References.Contains(data))
            throw new BSONException(StringConsts.CLR_BSON_CONVERSION_REFERENCE_CYCLE_ERROR.Args(tp.FullName));
        ts_References.Add( data );
        try
        {
          return DoConvertCLRtoBSON(fieldName, data, tp, targetName);
        }
        finally
        {
          ts_References.Remove( data );
        }
      }
public BSONElement ConvertCLRtoBSON ( string fieldName , object data , string targetName ) { if ( data == null ) return fieldName != null ? new BSONNullElement ( fieldName ) : new BSONNullElement ( ) ; var tp = data . GetType ( ) ; if ( tp . IsValueType ) return DoConvertCLRtoBSON ( fieldName , data , tp , targetName ) ; if ( ts_References == null ) ts_References = new HashSet < object > ( NFX . ReferenceEqualityComparer < object > . Instance ) ; if ( ts_References . Contains ( data ) ) throw new BSONException ( StringConsts . CLR_BSON_CONVERSION_REFERENCE_CYCLE_ERROR . Args ( tp . FullName ) ) ; ts_References . Add ( data ) ; try { return DoConvertCLRtoBSON ( fieldName , data , tp , targetName ) ; } finally { ts_References . Remove ( data ) ; } }
Converts CLR value to BSON.
Converts CLR value to BSON .
fieldName
string
data
object
targetName
string