public void MapModifiedFlagsToMapFromEntity(ISessionImplementor session, IDictionary <string, object> data, object newObj, object oldObj)
        {
            var propertyData = CommonCollectionMapperData.CollectionReferencingPropertyData;

            if (propertyData.UsingModifiedFlag)
            {
                if (isNotPersistentCollection(newObj) || isNotPersistentCollection(oldObj))
                {
                    //Compare POCOs
                    data[propertyData.ModifiedFlagPropertyName] = !Toolz.ObjectsEqual(newObj, oldObj);
                }
                else
                {
                    var newObjAsPersistentCollection = (IPersistentCollection)newObj;
                    if (isFromNullToEmptyOrFromEmptyToNull(newObjAsPersistentCollection, oldObj))
                    {
                        data[propertyData.ModifiedFlagPropertyName] = true;
                    }
                    else
                    {
                        var changes = MapCollectionChanges(session, propertyData.Name, newObjAsPersistentCollection, oldObj, null);
                        data[propertyData.ModifiedFlagPropertyName] = changes.Any();
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public void MapModifiedFlagsToMapFromEntity(ISessionImplementor session, IDictionary <string, object> data, object newObj, object oldObj)
 {
     if (_propertyData.UsingModifiedFlag)
     {
         data[_propertyData.ModifiedFlagPropertyName] = !Toolz.ObjectsEqual(newObj, oldObj);
     }
 }