Example #1
0
            /// <summary>
            /// Get the value of the metadata, by metadata kind (aka column name).
            /// </summary>
            public void GetValue <TValue>(string kind, ref TValue value)
            {
                var column = Schema.GetColumnOrNull(kind);

                if (column == null)
                {
                    throw MetadataUtils.ExceptGetMetadata();
                }
                GetGetter <TValue>(column.Value.Index)(ref value);
            }
Example #2
0
            /// <summary>
            /// Get the value of an annotation, by annotation kind (aka column name).
            /// </summary>
            public void GetValue <TValue>(string kind, ref TValue value)
            {
                var column = Schema.GetColumnOrNull(kind);

                if (column == null)
                {
                    throw new InvalidOperationException($"Invalid call to '{nameof(GetValue)}'");
                }
                GetGetter <TValue>(column.Value)(ref value);
            }
            /// <summary>
            /// Get the value of the metadata, by metadata kind (aka column name).
            /// </summary>
            public void GetValue <TValue>(string kind, ref TValue value)
            {
                var column = Schema.GetColumnOrNull(kind);

                if (column == null)
                {
                    throw new InvalidOperationException("Invalid call to GetMetadata");
                }
                GetGetter <TValue>(column.Value.Index)(ref value);
            }
Example #4
0
        public void ExpandExpressionsNonCompileInvocationTest()
        {
            Expression <Func <int, int> > f1 = x => GetGetter()() + x;

            Assert.AreEqual(2, f1.Compile()(1));

            var result = f1.ExpandExpressions();

            NoDuplicateParameterAssertion.AssertNoDuplicateParameters(result);
            Assert.AreEqual(2, result.Compile()(1));
            NoEvaluationsAssertion.AssertNoEvaluations(result);
        }
Example #5
0
 /// <summary>
 /// Gets the default value for the specified parameter.
 /// </summary>
 /// <param name="name">
 /// The name of the parameter to get the default value of.
 /// </param>
 /// <returns>
 /// The default value of the specified parameter.
 /// </returns>
 /// <exception cref="GetValueException">
 /// If the ETS call to get the property value throws an exception.
 /// </exception>
 internal override object GetDefaultParameterValue(string name)
 {
     try
     {
         return(GetGetter(Target.GetType(), name)(Target));
     }
     catch (TargetInvocationException ex)
     {
         Exception inner = ex.InnerException ?? ex;
         throw new GetValueInvocationException("CatchFromBaseAdapterGetValueTI",
                                               inner,
                                               ExtendedTypeSystem.ExceptionWhenGetting,
                                               name, inner.Message);
     }
     catch (GetValueException) { throw; }
     catch (Exception e)
     {
         throw new GetValueInvocationException("CatchFromBaseAdapterGetValue",
                                               e,
                                               ExtendedTypeSystem.ExceptionWhenGetting,
                                               name, e.Message);
     }
 }
Example #6
0
        internal override object GetDefaultParameterValue(string name)
        {
            object obj2;

            try
            {
                obj2 = GetGetter(base.Target.GetType(), name)(base.Target);
            }
            catch (TargetInvocationException exception)
            {
                Exception innerException = exception.InnerException ?? exception;
                throw new GetValueInvocationException("CatchFromBaseAdapterGetValueTI", innerException, ExtendedTypeSystem.ExceptionWhenGetting, new object[] { name, innerException.Message });
            }
            catch (GetValueException)
            {
                throw;
            }
            catch (Exception exception3)
            {
                CommandProcessorBase.CheckForSevereException(exception3);
                throw new GetValueInvocationException("CatchFromBaseAdapterGetValue", exception3, ExtendedTypeSystem.ExceptionWhenGetting, new object[] { name, exception3.Message });
            }
            return(obj2);
        }
Example #7
0
 public static TValue Get <TValue>(TImplementation instance, string propertyName)
 {
     return(GetGetter <TValue>(propertyName)(instance));
 }
Example #8
0
 public static TValue Get <TValue>(TType instance, string propertyName)
 {
     return(GetGetter <TValue>(propertyName)(instance));
 }