I want to map a readonly property to a computed column in Sql Server using Fluent NHibernate. The property is the substring of another one. I do this to make the substring indexable and have better search performance. But when I use the Formula function in mapping, the property does not map to a computed column in database but it is computed when using query.
Class Person{
public virtual string name {get; set;}
public virtual string subName {get; set;}
}
Class PersonMap : ClassMap<Person>{
Map(p => p.name);
Map(p => p.subName).Generated.Always().Formula("substring(name, 0, 5)");
}