I don't know how I can accomplish this task I have tried numerous ways and all come up with one error or another. the few ways I have tried that did not error out on my instead just did not provide me with the results I was looking for.
Example of what I am looking for in end result
{
'type': 'NamedAA',
'id': '63c0f27a-716e-804c-6873-cd99b945b63f',
'x': 80,
'y': 59,
'width': 99,
'height': 107,
'userData': {
},
'cssClass': 'DBTable',
'bgColor': '#DBDDDE',
'color': '#D7D7D7',
'stroke': 1,
'alpha': 1,
'radius': 3,
'name': 'DuringHoursAutoAttendant',
'entities': [
{
'text': 'id',
'id': '49be7d78-4dcf-38ab-3733-b4108701f1'
},
{
'text': 'employee_fk',
'id': '49be7d78-4dcf-38ab-3733-b4108701fce4'
}
]
}
The code that is giving me error
var aahope=new JObject(
new JProperty("type", "NamedAA"),
new JProperty("id",aaid),
new JProperty("x",80),
new JProperty("y",59),
new JProperty("width",99),
new JProperty("height",107),
new JProperty("userData",new JObject()),
new JProperty("cssClass", "DBTable"),
new JProperty("bgColor", "#DBDDDE"),
new JProperty("color", "#D7D7D7"),
new JProperty("stroke",1),
new JProperty("alpha",1),
new JProperty("radius",3),
new JProperty("name",""),
new JProperty("entities", new JArray(
(from e in db.HostedVoiceAAKeys
where e.HostedVoiceAAID == aaid.HostedVoiceAAID
select new JObject(
new JProperty("id",e.OptionKey),
new JProperty("text",e.OptionGuid))).ToArray()
))
);
Error Message:
Only parameterless constructors and initializers are supported in LINQ to Entities.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.NotSupportedException: Only parameterless constructors and initializers are supported in LINQ to Entities.
Source Error:
Line 2763: var aaresults = "";
Line 2764: var aahope=new JObject(
Line 2765: new JProperty("type", "NamedAA"),
Line 2766: new JProperty("id",aaid),