我遇到問題,夏普體系結構將正確映射我在IAutoMappingOverride
類中設置的所有內容,但Formula
除外。這些被簡單地忽略,因此當試圖查詢數據庫時,我得到SQL的invalid identifier
。夏普體系結構忽略我的公式映射
// NUnit setup
public virtual void SetUp()
{
configuration = NHibernateSession.Init(
new SimpleSessionStorage(),
RepositoryTestsHelper.GetMappingAssemblies(),
new AutoPersistenceModelGenerator().Generate(),
null,
null,
null,
FluentConfigurer.TestConfigurer.Contracts);
new FluentConfigurer(configuration)
.ConfigureNHibernateValidator()
.ConfigureAuditListeners();
}
public AutoPersistenceModel Generate()
{
return AutoMap.AssemblyOf<Contrato>(new AutomappingConfiguration())
.Conventions.Setup(GetConventions())
.IgnoreBase<Entity>()
.IgnoreBase(typeof(EntityWithTypedId<>))
.UseOverridesFromAssemblyOf<EmployeeMap>();
}
// My override.
public class EmployeeMap : IAutoMappingOverride<Employee>
{
public void Override(AutoMapping<Employee> mapping)
{
// This works...
mapping.Id(x => x.Id, "ID_EMPLOYEE");
// This is ignored...
mapping.Map(x => x.Name).Formula("UPPER(LTRIM(RTRIM(FIRST_NAME || ' ' || LAST_NAME)))");
}
}
任何想法?