Q:

Can I convert a Func to a Func where T and U are POCO classes where I can map properties of one to the other? If so, how?

I have a scenario where a method will take a predicate of type Func< T, bool > because the type T is the one that is exposed to the outer world, but when actually using that predicate I need that method to call another method that will take in Func< U, bool > where properties of T are mapped to properties of U.
A more concrete example would be:
public IEnumerable<ClientEntity> Search(Func<ClientEntity, bool> predicate)
{
    IList<ClientEntity> result = new List<ClientEntity>();

    // Somehow translate predicate into Func<Client, bool> which I will call realPredicate.
    _dataFacade.Clients.Where(realPredicate).ToList().ForEach(c => result.Add(new ClientEntity() { Id = c.Id, Name = c.Name }));

    return result.AsEnumerable();
}

Would that be possible?
Please note that ClientEntity is a POCO class that I defined myself while Client is an Entity Framework class created by the model (DB first).
Thanks!

A:

What I ended up doing did not require the use of Expression Trees:
public IEnumerable<ClientEntity> Search(Func<ClientEntity, bool> predicate)
{
    IList<ClientEntity> result = new List<ClientEntity>();

    Func<Client, bool> realPredicate = (c => predicate(ConvertFromClient(c)));        
    _dataFacade.Clients.Where(realPredicate).ToList().ForEach(c => result.Add(ConvertFromClient(c)));

    return result.AsEnumerable();
}

private static ClientEntity ConvertFromClient(Client client)
{
    ClientEntity result = new ClientEntity();

    if (client != null)
    {
        // I actually used AutoMapper from http://automapper.org/ here instead of assigning every property.
        result.Id = client.Id;
        result.Name = client.Name;
    }

    return result;
}

