Feeling a bit stupid here now since this is probably something simple, but what is the syntax for creating a new type of object from a join?
var resourceTypes = Db.Select<ResourceType>(
Db
.From<ResourceTypeServiceRelation>()
.Join<ResourceTypeServiceRelation, ResourceType>(
(relation, resourceType) =>
relation.CompanyId == resourceType.CompanyId
&& relation.ResourceTypeId == resourceType.Id
&& relation.ServiceId == service.Id)
).ToList();
What if I here would want something else than ResourceType selected, say an anonymous object which contains fields from both sides in the join (that is from both ResourceTypeServiceRelation and ResourceType).
Something like:
var resourceTypes2 = Db.Select(
Db
.From<ResourceTypeServiceRelation>()
.Join<ResourceTypeServiceRelation, ResourceType>(
(relation, resourceType) =>
relation.CompanyId == resourceType.CompanyId
&& relation.ResourceTypeId == resourceType.Id
&& relation.ServiceId == service.Id)
.Select((relation, resourceType) => new { MyProp = relation.CompanyId, MySecondProp = resourceType.Id })
).ToList();