IAutoMappingOverrideを除いて、SharpArchitectureがクラスで設定したすべてのものを正しくマップするという問題があります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)))");
}
}
何か案は?