///***************************************************/ ///**** Public Methods ****/ ///***************************************************/ public static byte[] ToDiffingByteArray(this object obj, PropertyInfo[] fieldsToIgnore = null) { List <PropertyInfo> propList = fieldsToIgnore?.ToList(); if (propList == null || propList.Count == 0) { return(BsonExtensionMethods.ToBson(obj.ToBsonDocument())); // .ToBsonDocument() for consistency with other cases } List <string> propNames = new List <string>(); propList.ForEach(prop => propNames.Add(prop.Name)); return(ToDiffingByteArray(obj, propNames)); }
public static byte[] ToDiffingByteArray(this object obj, List <string> fieldsToIgnore) { if (fieldsToIgnore == null || fieldsToIgnore.Count == 0) { return(BsonExtensionMethods.ToBson(obj)); } var objDoc = obj.ToBsonDocument(); fieldsToIgnore.ForEach(propName => objDoc.Remove(propName) ); return(BsonExtensionMethods.ToBson(objDoc)); }
internal void ResetOrigEntity() { origEntityBytes = BsonExtensionMethods.ToBson(Entity, NominalType); _OrigEntity = null; }
public static byte[] ToBytes(this object obj) { BsonDocument doc = obj.ToBson(); return(BsonExtensionMethods.ToBson(doc)); }