1
I have a function convertStringListaInt
parameter String
.
Example :
String: 1,2.
I’m converting this string into a List of the kind convertStringListaInt_Result
owned by number
(whole).
How can I make a in
using Lambda?
I realized the Entity accepts only primitive types in 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;
}
}
Error Generated
An Exception of type 'System.Notsupportedexception' occurred in Entityframework.SqlServer.dll but was not handled in user code
Additional information: Unable to create a Constant value of type 'Model.DTO.convertStringListaInt_Result'. Only Primitive types or enumeration types are supported in this context.
@Marconi Enter here: http://chat.stackexchange.com/rooms/11910/batteryoverflow
– Leonel Sanches da Silva