I'm getting this error:
Only parameterless constructors and initializers are supported in LINQ to Entities.
When trying to run this code (found this code here and made test database to play around with):
XElement xml = new XElement("contacts",
from c in db.Contacts
orderby c.ContactId
select new XElement("contact",
new XAttribute("contactId", c.ContactId),
new XElement("firstName", c.FirstName),
new XElement("lastName", c.LastName))
);
where db is the auto created entities object. Any ideas on how to get this to work?