I have a function convertStringListaInt
with parameter String
.
Example:
String: 1,2 .
I'm converting this string to a List of type convertStringListaInt_Result
having property number
(integer).
How can I make a in
using Lambda ?
I noticed Entity accepts only primitive types in the comparison and that is why the error is generated.
Code:
public static bool ExisteAIPR(string IDEscopo) {
using(entidadesIUS entidades = new entidadesIUS()) {
List <convertStringListaInt_Result> resultado = entidades.convertStringListaInt(IDEscopo).ToList();
return entidades.Escopos.Where(e => resultado.Select(x => x.number).Contains(e.IDEscopo) && e.AIPR == "S").FirstOrDefault() != null ? true : false;
}
}
Generated Error
An exception of type 'System.NotSupportedException' occurred in EntityFramework.SqlServer.dll but was not handled in user codeAdditional information: Unable to create a constant value of type 'Template.DTO.convertStringListaInt_Result'. Only primitive types or enumeration types are supported in this context.