Exemple #1
0
        ///***************************************************/
        ///**** 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));
        }
Exemple #2
0
        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));
        }
Exemple #3
0
 internal void ResetOrigEntity()
 {
     origEntityBytes = BsonExtensionMethods.ToBson(Entity, NominalType);
     _OrigEntity     = null;
 }
Exemple #4
0
        public static byte[] ToBytes(this object obj)
        {
            BsonDocument doc = obj.ToBson();

            return(BsonExtensionMethods.ToBson(doc));
        }