I am tring to create XML file using ASP-VB.NET (Visual Studio 2008/2010)
When I use following code with LINQ to SQL it works perfectly.
[code] Dim xmlContext =
<%= From cm In mData.COUNTIES _
Where cm.STATE_ID = 39 _
Select <Name><%= cm.NAME %> %>
[/code]
Tried to run it with LINQ to Entities and got Error:
[color=Blue]Only parameterless constructors and initializers are supported in LINQ to Entities.[/color]
I understand that LINQ to Entities takes a different approach than LINQ to SQL in some areas.
I tried to use XML options:
[code]Dim xmlContext = From cm In mData.COUNTIES _
Where cm.STATE_ID = 39 _
Select New XElement("CountiesMunicipalities",
New XAttribute("County", cm.NAME))[/code]
and got the same result
Does somebody know how to use LINQ to Entities to create XML File?
Comments
[code]Dim xmlContext =
<%= From cm In [color=Red][b]mData.COUNTIES.ToList [/b][/color]_
Where cm.STATE_ID = 39 _
Select <Name><%= cm.NAME %> %>
[/code]