Hi James
Thanks for the bug report, I'll look into next before moving onto component
mapping and will let you know when it's fixed.

Thanks

Andy

On Wed, Dec 10, 2008 at 3:22 PM, James Willock <
james.will...@mulhollandsoftware.com> wrote:

>
> Hi, I believe I have spotted an issue with the AutoPeristanceModel
> where if you specifiy a .ForTypesThatDeriveFrom clause, the T type
> will be added to the _mapping member of the base PersistenceModel,
> even though you may have specified a .Where clause which would exclude
> that type.
>
> For example; I have an entity base class in one namespace, but am
> setting up mappings in a second namespace, and I want to specify some
> extra information for objects in the second namespace which derive
> from the base object in the first namespace.
>
> Subsequently when calling AutoPersistanceModel.Configure an error is
> thrown as it tries to add a mapping document for the base class to the
> Configuration object (the XML is invalid).  I would expect the base
> class to be ignored?
>
> My call looks like this:
>
>            var autoPersistanceModel = AutoPersistenceModel
>                .MapEntitiesFromAssemblyOf<Rss.Entity.RssFilter>()
>                .Where(t => t.Namespace == typeof
> (Rss.Entity.RssFilter).Namespace)
>                .WithConvention(c =>
>                    {
>                        c.DefaultStringLength = 255;
>                        c.FindIdentity = p => p.Name == "ID";
>                        c.GetPrimaryKeyName = p =>
> p.ReflectedType.Name + "Id";
>                    })
>                .ForTypesThatDeriveFrom<Rss.Entity.UrlItem>(map =>
> map.Map(p => p.Name).WithLengthOf(2000))
>                .ForTypesThatDeriveFrom<SeededEntityBase>(map =>
> map.Map(p => p.Name).WithLengthOf(50));
>
> In summary SeededEntityBase is getting mapped even though the Where
> clause should exlude it.
>
>
> Exception details:
>
> MappingException:- (XmlDocument)(4,6): XML validation error: The
> element 'class' in namespace 'urn:nhibernate-mapping-2.2' has invalid
> child element 'property' in namespace 'urn:nhibernate-mapping-2.2'.
> List of possible elements expected: 'meta, jcs-cache, cache, id,
> composite-id' in namespace 'urn:nhibernate-mapping-2.2'.
>
>
> >
> FluentNHibernate.dll!FluentNHibernate.MappingVisitor.AddMappingDocument(System.Xml.XmlDocument
> document = {Document}, System.Type type = {Name = "SeededEntityBase"
> FullName = "Roosst.Core.Data.SeededEntityBase"}) Line 38 + 0x11 bytes
> C#
>        FluentNHibernate.dll!
>
> FluentNHibernate.Mapping.ClassMap<Roosst.Core.Data.SeededEntityBase>.ApplyMappings
> (FluentNHibernate.IMappingVisitor visitor =
> {FluentNHibernate.MappingVisitor}) Line 110 + 0x47 bytes        C#
>        FluentNHibernate.dll!
> FluentNHibernate.PersistenceModel.Configure.AnonymousMethod
> (FluentNHibernate.Mapping.IMapping mapping =
> {FluentNHibernate.AutoMap.AutoMap<Roosst.Core.Data.SeededEntityBase>})
> Line 107 + 0xf bytes    C#
>        [External Code]
>        FluentNHibernate.dll!FluentNHibernate.PersistenceModel.Configure
> (NHibernate.Cfg.Configuration configuration =
> {NHibernate.Cfg.Configuration}) Line 108        C#
>        FluentNHibernate.dll!
> FluentNHibernate.AutoMap.AutoPersistenceModel.Configure
> (NHibernate.Cfg.Configuration configuration =
> {NHibernate.Cfg.Configuration}) Line 71 C#
>        Roosst.Domain.dll!Roosst.Domain.SessionFactoryProvider.ApplyMappings
> (NHibernate.Cfg.Configuration configuration =
> {NHibernate.Cfg.Configuration}) Line 53 + 0xb bytes     C#
>
>
> >
>


-- 
=================
I-nnovate Software - Bespoke Software Development, uk wirral.
http://www.i-nnovate.net

--~--~---------~--~----~------------~-------~--~----~
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