Exemplo n.º 1
0
        public bool TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, object value, out object result)
        {
            if (optionalValue == null)
            {
                return(TryConvertVoid(value, out result));
            }

            if (optionalValue.Type.FullyQualifiedName != null)
            {
                return(TryConvertCustomType(referenceMap, value, optionalValue.IsOptional, optionalValue.Type.FullyQualifiedName, out result));
            }

            if (optionalValue.Type.Primitive != null)
            {
                return(TryConvertPrimitive(referenceMap, value, optionalValue.IsOptional, optionalValue.Type.Primitive.Value, out result));
            }

            if (optionalValue.Type.Collection != null)
            {
                return(TryConvertCollection(referenceMap, value, optionalValue.IsOptional, optionalValue.Type.Collection, out result));
            }

            if (optionalValue.Type.Union != null)
            {
                return(TryConvertUnion(referenceMap, value, optionalValue.IsOptional, optionalValue.Type.Union, out result));
            }

            throw new ArgumentException("Invalid type reference", nameof(optionalValue));
        }
Exemplo n.º 2
0
 public CallbackResult(IOptionalValue optionalValue, object?value)
     : this(optionalValue.Type, optionalValue.IsOptional, value)
 {
 }
Exemplo n.º 3
0
 public Type GetFrameworkType(IOptionalValue instance)
 {
     return(GetFrameworkType(instance?.Type, instance?.IsOptional ?? false));
 }
Exemplo n.º 4
0
 public CallbackResult(IOptionalValue optionalValue, object value)
     : this(optionalValue?.Type, optionalValue?.IsOptional ?? false, value)
 {
 }
Exemplo n.º 5
0
 public bool TryConvert(IOptionalValue optionalValue, IReferenceMap referenceMap, object value, out object result)
 {
     return(TryConvert(optionalValue, typeof(object), referenceMap, value, out result));
 }