freejohnafforymar
New Member
I'm using EF4, dotnet 4. I want to create an edmx function to help me get xml values from an xml column (SQLServer 2008R2). My question is basically the same as posted on Entity Framework Query XmlI started off by creating the function in my C# file as such:\[code\] [System.Data.Objects.DataClasses.EdmFunction("ModelNamespace", "String_XmlField")] public static String XmlField(this String data, String path) { throw new Exception("Not implemented"); }\[/code\]The next piece went into my edmx (correct csdl schema):\[code\] <Function Name="String_XmlField" ReturnType="Edm.String"> <Parameter Name="data" Type="Edm.String" /> <Parameter Name="path" Type="Edm.String" /> <DefiningExpression> data.value(path, "nvarchar(max)") </DefiningExpression> </Function>\[/code\]And i'm trying to use it like this:source = source.Where(x => x.NewData.XmlField("(//IDPat/node())[1]") == "3152");The error i'm getting is: "An error occurred while preparing definition of the function 'ModelNamespace.String_XmlField'. See the inner exception for details.", with an inner exception with message "'value' is not a member of type 'Edm.String' in the currently loaded schemas. Near simple identifier, line 2, column 18."I'm pretty sure the error lies in the edmx part missing in the original response, but i can't find the problem.