Imports System
Imports System.CodeDom
Imports System.Web.Compilation
Imports System.Web.UI

<ExpressionPrefix("MyCustomExpression"), _
ExpressionEditor("MyCustomExpressionEditor")> _
Public Class MyCustomExpression
    Inherits ExpressionBuilder

    Public Overrides Function _
        GetCodeExpression(ByVal entry As BoundPropertyEntry, _
            ByVal parsedData As Object, ByVal context As ExpressionBuilderContext) _
            As System.CodeDom.CodeExpression

        Return New CodeCastExpression("Int64", _
            New CodePrimitiveExpression(parsedData))
    End Function

    Public Overrides Function ParseExpression _
        (ByVal expression As String, ByVal propertyType As Type, _
            ByVal context As ExpressionBuilderContext) As Object

        Return expression
    End Function

    Public Overrides ReadOnly Property SupportsEvaluate() As Boolean
        Get
            Return True
        End Get
    End Property

    Public Overrides Function EvaluateExpression(ByVal target As Object, _
        ByVal Entry As BoundPropertyEntry, ByVal parsedData As Object, _
        ByVal context As ExpressionBuilderContext) As Object

        Return parsedData
    End Function

End Class
