コード例 #1
0
 /// <summary>
 ///     Creates a an expression tree that can be used to generate code for the literal value.
 ///     Currently, only very basic expressions such as constructor calls and factory methods taking
 ///     simple constants are supported.
 /// </summary>
 /// <param name="value"> The value for which a literal is needed. </param>
 /// <returns> An expression tree that can be used to generate code for the literal value. </returns>
 public override Expression GenerateCodeLiteral(object value)
 => Expression.Convert(
     Expression.Call(
         Expression.New(WKTReaderType),
         WKTReaderType.GetMethod("Read", new[] { typeof(string) }),
         Expression.Constant(CreateWktWithSrid(value), typeof(string))),
     value.GetType());
コード例 #2
0
 /// <summary>
 ///     Creates a an expression tree that can be used to generate code for the literal value.
 ///     Currently, only very basic expressions such as constructor calls and factory methods taking
 ///     simple constants are supported.
 /// </summary>
 /// <param name="value"> The value for which a literal is needed. </param>
 /// <returns> An expression tree that can be used to generate code for the literal value. </returns>
 public override Expression GenerateLiteralExpression(object value)
 => Expression.Convert(
     Expression.Call(
         Expression.New(WKTReaderType),
         WKTReaderType.GetMethod("Read", new[] { typeof(string) }),
         Expression.Constant(AsText(value), typeof(string))),
     value.GetType());