I’m not sure if this is supported or not.
I have an explicit join and I’m trying to map certain values from both tables to an existing type (SearchResult) and get a List of SearchResult as a result.
public class SearchResult
{
public string? CustomerId { get; set; }
public int ServerId { get; set; }
public string? Company { get; set; }
public string? PhoneNumber { get; set; }
public string? Name { get; set; }
public string? Email { get; set; }
}
var explicitJoin = Db.From<CustomerPhoneNumber>()
.Join<CustomerProperties>(
(number, properties) => number.CustomerId == properties.CustomerId)
.Where<CustomerPhoneNumber>(x => x.PhoneNumber != null && x.PhoneNumber.Contains("partOfPhoneNumber"))
.Select<CustomerPhoneNumber, CustomerProperties>((customerNumber, customerProperties) =>
new SearchResult { CustomerId = customerNumber.CustomerId, ServerId = customerNumber.ServerId, Company = customerProperties.Description, PhoneNumber = customerNumber.PhoneNumber });
Db.Select(explicitJoin).PrintDump();
I’m getting the following error:
variable ‘customerNumber’ of type ‘CustomerPhoneNumber’ referenced from scope ‘’, but it is not defined.
Is this supported and how can I accomplish this?
Thanks a lot.