title: Domain objects, entity objects and repository with LINQ expression
body: <p>I have WPF MVVM application, where entity objects are generated using Code First from Database. Then I have domain objects, where business logic is. I have generic repository which returns domain objects (AutoMapped from entity objects). Is there any way to easily convert domain object predicate (???) to entity predicate? I want to avoid exposing entity objects in MainRepository if possible.</p>
  
  <pre><code>Class GenericRepository(Of TEntity As Class, TContext As DbContext)
    Function Select(predicate As Func(Of TEntity, Boolean) As IList(Of TEntity)
      Return context.Set(Of TEntity)().Where(predicate).ToList()
    End Function
  End Class
  
  Class MainRepository
    Private _repository As New GenericRepository(Of ProductEntity, ProductionContext)
    Sub SelectProducts(???) As IList(Of ProductDomainObject)
      Dim entities = _repository.Select(???)
      Return (AutoMap entities to domain objects)
    End Sub
  End Class
  </code></pre>