Hello guys.

I'm converting some old code I had which used mapping visitors to load and
populate the Configurationn object. I was under the impression that this
code:

  var configuration = Fluently.Configure( )
                        .Database( GetDatabaseInfo() )
                        .Mappings( m => m.FluentMappings.AddFromAssembly(
assembly ) )
                        .ExposeConfiguration( config => SetupConfiguration(
config )  )
                        .BuildConfiguration();

Should do the same thing. Btw, Getdatabaseinfo looks like this:


protected virtual IPersistenceConfigurer GetDatabaseInfo( )
        {
            return MsSqlConfiguration.MsSql2005
                    .ConnectionString( s => s.Is( _connectionString ) )
                    .ShowSql();
                                    
        }

And SetupConfiguration looks like this:

protected override void SetupConfiguration(NHibernate.Cfg.Configuration
configuration)
        {
            configuration.EventListeners.LoadEventListeners = new[] {new
CustomLoadEventListener()};
        }

Now, the problem is that I'm getting this:

MSBUILD : warning :
Sra.Core.Entities.Repositories.Tests.CivilParishRepositoryLoadInexistentPari
shById.Should_return_null_for_non_existing_parish:
FluentNHibernate.Cfg.FluentConfigurationException : An invalid or incomplete
configuration was used while creating a SessionFactory. Check
PotentialReasons collection, and InnerException for more detail.
MSBUILD : warning : 
MSBUILD : warning : 
MSBUILD : warning : ---- System.ApplicationException : Error while trying to
build the Mapping Document for 'Sra.Core.Entities.Entity'
MSBUILD : warning : -------- NHibernate.MappingException :
(XmlDocument)(8,6): XML validation error: The element 'class' in namespace
'urn:nhibernate-mapping-2.2' has invalid child element 'discriminator' in
namespace 'urn:nhibernate-mapping-2.2'. List of possible elements expected:
'property, many-to-one, one-to-one, component, dynamic-component, any, map,
set, list, bag, idbag, array, primitive-array, join, subclass,
joined-subclass, union-subclass, loader, sql-insert, sql-update, sql-delete,
filter' in namespace 'urn:nhibernate-mapping-2.2'.
MSBUILD : warning : ------------
System.Xml.Schema.XmlSchemaValidationException : The element 'class' in
namespace 'urn:nhibernate-mapping-2.2' has invalid child element
'discriminator' in namespace 'urn:nhibernate-mapping-2.2'. List of possible
elements expected: 'property, many-to-one, one-to-one, component,
dynamic-component, any, map, set, list, bag, idbag, array, primitive-array,
join, subclass, joined-subclass, union-subclass, loader, sql-insert,
sql-update, sql-delete, filter' in namespace 'urn:nhibernate-mapping-2.2'.
MSBUILD : warning :    at
FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
MSBUILD : warning :    at
Sra.Core.Repositories.NHFluentConfigurationBuilderBase.GetConfigAndSessionFa
ctory() in
D:\Projects\Sra.Core\SRA.Core.Repositories\NHFluentConfigurationBuilder.cs:l
ine 59
MSBUILD : warning :    at
Sra.Core.Repositories.NHFluentConfigurationBuilderBase.GetSession() in
D:\Projects\Sra.Core\SRA.Core.Repositories\NHFluentConfigurationBuilder.cs:l
ine 29
MSBUILD : warning :    at
Sra.Core.Entities.Repositories.Tests.BehaviourWithTransaction.StartTransacti
on(Action`2 method) in
D:\Projects\Sra.Core\SRA.Core.Entidades.Repositories.Tests\BehaviourWithTran
saction.cs:line 14
MSBUILD : warning :    at
Sra.Core.Entities.Repositories.Tests.CivilParishRepositoryLoadInexistentPari
shById.Should_return_null_for_non_existing_parish() in
D:\Projects\Sra.Core\SRA.Core.Entidades.Repositories.Tests\CivilParishReposi
toryLoadInexistentParishById.cs:line 10
MSBUILD : warning : ----- Inner Stack Trace -----
MSBUILD : warning :    at
FluentNHibernate.Mapping.ClassMap`1.ApplyMappings(IMappingVisitor visitor)
MSBUILD : warning :    at
FluentNHibernate.PersistenceModel.<>c__DisplayClass1.<ApplyMappings>b__0(ICl
assMap mapping)
MSBUILD : warning :    at System.Collections.Generic.List`1.ForEach(Action`1
action)
MSBUILD : warning :    at
FluentNHibernate.PersistenceModel.ApplyMappings(IMappingVisitor visitor)
MSBUILD : warning :    at
FluentNHibernate.PersistenceModel.Configure(Configuration configuration)
MSBUILD : warning :    at
FluentNHibernate.Cfg.FluentMappingsContainer.Apply(Configuration cfg)
MSBUILD : warning :    at
FluentNHibernate.Cfg.MappingConfiguration.Apply(Configuration cfg)
MSBUILD : warning :    at
FluentNHibernate.Cfg.FluentConfiguration.BuildConfiguration()
MSBUILD : warning : ----- Inner Stack Trace -----

I haven't changed anything in the mappins so I was wondering if anyone could
help. In my previous code (where I loaded the types "by hand"), I made sure
that abstract types shouldn't be loaded (Sra.Core.Entities.Entity is a base
class reused by other entities). However, it seems like fluent is trying to
map that class. Any easy way of saying that it should ignore that class?

Thanks
Luis




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
To unsubscribe from this group, send email to 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to