public CodegenExpression UnderlyingFragmentCodegen(
            CodegenExpression underlyingExpression,
            CodegenMethodScope codegenMethodScope,
            CodegenClassScope codegenClassScope)
        {
            var ff = codegenClassScope.AddDefaultFieldUnshared(
                true,
                typeof(FragmentFactory),
                fragmentFactory.Make(codegenClassScope.NamespaceScope.InitMethod, codegenClassScope));
            if (!isArray) {
                return StaticMethod(
                    GetType(),
                    "GetValueAsNodeFragment",
                    underlyingExpression,
                    Constant(propertyName),
                    ff);
            }

            return StaticMethod(
                GetType(),
                "GetValueAsNodeFragmentArray",
                underlyingExpression,
                Constant(propertyName),
                ff);
        }
 private CodegenMethod GetValueAsFragmentCodegen(
     CodegenMethodScope codegenMethodScope,
     CodegenClassScope codegenClassScope)
 {
     var member = codegenClassScope.AddDefaultFieldUnshared(
         true,
         typeof(FragmentFactory),
         fragmentFactory.Make(codegenClassScope.NamespaceScope.InitMethod, codegenClassScope));
     return codegenMethodScope.MakeChild(typeof(object), GetType(), codegenClassScope)
         .AddParam(typeof(XmlNode), "node")
         .Block
         .DeclareVar<XmlNode>(
             "result",
             GetValueAsNodeCodegen(Ref("node"), codegenMethodScope, codegenClassScope))
         .IfRefNullReturnNull("result")
         .MethodReturn(ExprDotMethod(member, "GetEvent", Ref("result")));
 }