Question

J'ai un problème où une architecture nette mappera correctement tout ce que j'ai configuré dans mon IAutoMappingOverride cours, sauf pour Formula. Ceux-ci sont simplement ignorés et donc je reçois SQL invalid identifier Lorsque vous essayez d'interroger la base de données.

// 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)))");
    }
}

Des idées?

Pas de solution correcte

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top