Пример #1
0
        public ObjectData ToData(object @object,
                                 ObjectDataConvertSettings settings = null, ObjectDataConvertSession session = null)
        {
            if (ValueData.CanCreate(@object))
            {
                throw new ArgumentException($"Object can be only converted to {typeof(ValueData)}", nameof(@object));
            }

            return(ToData(this, @object, settings, session));
        }
Пример #2
0
        public bool AddConverted(object @object, ObjectData data)
        {
            Ensure.Argument.NotNull(@object, nameof(@object));

            if (ValueData.CanCreate(@object))
            {
                return(false);
            }

            return(_objectToData.TryAdd(@object, data) ||
                   _dataToObject.TryAdd(data, @object));
        }