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.
Dim xmlContext = <CountiesMunicipalities>
<County><%= From cm In mData.COUNTIES _
Where cm.STATE_ID = 39 _
Select <Name><%= cm.NAME %></Name> %></County>
</CountiesMunicipalities>
Tried to run it with LINQ to Entities and got Error:
Only parameterless constructors and initializers are supported in LINQ to Entities.
I understand that LINQ to Entities takes a different approach than LINQ to SQL in some areas.
I tried to use XML options:
Dim xmlContext = From cm In mData.COUNTIES _
Where cm.STATE_ID = 39 _
Select New XElement("CountiesMunicipalities",
New XAttribute("County", cm.NAME))
and got the same result
Does somebody know how to use LINQ to Entities to create XML File?