I see that it is easy enough to perform a LeftJoin on types that are known at design time, however I am struggling to write an Ormlite query that allow me to join two types/tables that are not known until runtime.
I have two tables that have the same schema and want to do check whether there are differences between rows based on their Id property.
The first type is the generic type parameter for the class in which I need to make this call. The second type isn't known until run time as it is read from a dictionary.
I had hoped that I could get something like this to work but it complains that type 'lambda expression' cannot be assigned to
var records = connection.Select(connection.From<T>()
.Where((c1, c2) => c1.Id == c2.Id));
You're not going to be able to use OrmLite's SqlExpression to build a Typed API on unknown compile time types. You'll need to drop down Custom SQL as seen in this earlier answer: https://forums.servicestack.net/t/self-reference-from-joinalias/2964/4?u=mythz
Thanks, Demis. That works a treat.