i have LINQ expression node type ArrayIndex is not suported in LINQ to Entities error when i am trying to do the following
public List<AttachmentList> ShowAttachments(int type, int ReferenceId)
{
try
{
var attachmentNames =
(from attachment in tent.Attachments
where (attachment.Attachment_Type == type
&& attachment.Attachment_Reference_Pk == ReferenceId)
select new AttachmentList
{
Attachment_Pk = attachment.Attachment_Pk,
Attachment_File_Path = attachment
.Attachment_File_Path.Split(new[] {'$'})[1]
}).ToList();
return attachmentNames;
}
catch (Exception ex)
{
ExceptionHandler.ExceptionLog(ex);
return null;
}
}
As you can see that i am trying to split the Attachmentfilepath which contains '$' and assign the second value([1]) to the Attachment_FilePath
Can anyone please suggest how i can split and assign the value to the AttachmentList string in the same query
Thanks
To be honest, the simplest approach would be to do the splitting on the client-side, unless you really need it to be a fully-fledged entity. For example: