我遇到了一个问题,Sharp Architecture 将正确映射我在IAutoMappingOverride
课程中设置的所有内容,除了Formula
. 这些被简单地忽略了,因此我invalid identifier
在尝试查询数据库时得到了 SQL。
// 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)))");
}
}
有任何想法吗?