public static Data ToData(object @object, ObjectDataConvertSettings settings = null, ObjectDataConvertSession session = null) { if (ValueData.TryCreate(@object, out var valueData)) { return(valueData); } return(ObjectDataConverter.ToData(null, @object, settings, session)); }
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)); }
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)); }