Why does an unmapped property that returns another property return me an error?

1

Good to see, I have a navigation error in an EF class where Linq navigation is not supported, I would like to know if someone happened this and if they have any suggestions on how to solve my problem.

Error: The specified type member 'Prop2' is not supported in LINQ to Entities. Only initializers, entity members, and entity navigation properties are supported

Classes

// Clase que contiene la propiedad a consumir
public Class1
{
  public Class1
  {
     Prop1 = new HashSet<Class2>();
  }
  public virtual HashSet<Class2> Prop1 {get;set;}

  // Propiedad no mapeada
  public HashSet<Class2> Prop2 => Prop1.Where(x => x.IsActive).ToHashSet();
}

// Para consumir intento hacer esto y me retorna el error  
var miObjeto = DbContenxt.Class1.Where(x => x.Prop2.Any());

I already appreciate the help you can give me

    
asked by Moisés Rivas 11.08.2017 в 20:10
source

0 answers