I have a string property on a class that I would like mapped to a Substring of another column.
Lets say this is my class:
public class MyClass
{
public virtual string PartNumber { get; set; }
public virtual string PartNumberPortion { get; set; }
}
And this is my MappingOverride:
public void Override(AutoMapping<MyClass> mapping)
{
mapping.Map(x => x.PartNumberPortion, "PartNumber").Formula("SUBSTRING(4,20, PartNumber)");
}
The .Formula() piece doesn't work like I had hoped. Is it possible to map a field to a substring of another field?
FYI, I wouldn't need to do this if I could run this query:
PartNumber.Substring(3).Contains("12345")
Unfortunately, having a Substring in a query results in:
Cannot use subqueries on a criteria without a projection.