Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

XSLT Linq Query Error

$
0
0

Hi,

I have a method in an xsl file, which uses Entity Framework to load data from SQL Server.

The method works fine when I test it in a C# class. The only error I get is...

XslLoadException was caught:
) expected

I don't see any missing bracket. I replaced the try/catch block to: return "test";

This worked fine. So I am not sure what is wrong with the Linq query?

Code...

<msxsl:script language="C#" implements-prefix="userCSharp"><msxsl:assembly href="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /><msxsl:using namespace="System.Linq" /><msxsl:using namespace="System.Collections.Generic" /><msxsl:assembly href="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.Entity.dll" /><msxsl:using namespace="System.Data.Entity" /><msxsl:assembly href="C:\myAssembly.dll" /><msxsl:using namespace="myAssembly" /><![CDATA[
public string GetMappingValue(string name, string value)
{
    using (Entities entities = new Entities())
    {
        try
        {
            var mappedValues = (from c in entities.GetMappedValue(name, value)
                                                select c).FirstOrDefault();
            return mappedValues.ToString();
        }
        catch (Exception exception)
        {
            throw;
        }
    }
}

]]></msxsl:script>



Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>