The only thing I can think of is maybe this in ClassMapBase:

protected void writeTheParts(XmlElement classElement, IMappingVisitor
visitor)
        {
            _properties.Sort(new MappingPartComparer());
            foreach (IMappingPart part in _properties)
            {
                part.Write(classElement, visitor);
            }
        }

where it does the sort on the list before it adds them. Because when I
use CreateMapping vs WriteMappingsTo they are different and
CreateMapping is consistent with what the db/NH sees, unless you do
WriteMappingsTo then that is consistent.

On Jan 8, 10:35 am, "James Gregory" <jagregory....@gmail.com> wrote:
> I'm still confused by how they can be different orders.
> This is how the mappings are added to NHibernate:
> public virtual void Configure(Configuration configuration)
> {
>   _configured = true;
>
>   MappingVisitor visitor = new MappingVisitor(_conventions, configuration,
> _chain);
>   _mappings.ForEach(mapping => mapping.ApplyMappings(visitor));
>
> }
>
> This is how they're written out:
> public void WriteMappingsTo(string folder)
> {
>   DiagnosticMappingVisitor visitor = new DiagnosticMappingVisitor(folder,
> _conventions, null, _chain);
>   _mappings.ForEach(m => m.ApplyMappings(visitor));
>
> }
>
> As you can see, they're nigh-on-identical.
>
> On Thu, Jan 8, 2009 at 4:17 PM, Ryan Kelley <rpkel...@gmail.com> wrote:
>
> > I believe that using the PersisitnceModel.WritemappingsTo yields
> > diferent results than the XML that is acutally used if you don't write
> > the mapings though. By different, I mean the order of the properties
> > are different. So as long as you are not concerned about what order
> > the properties come in then it should be fine. The other way is to do
> > something like this:
>
> >  Use an IMappingVisitor to do this:
>
> > // This code is the caller to write the files
> > IList<IMapGenerator> mappers = GeneratorHelper.GetMapGenerators();
> >            foreach (var mapper in mappers)
> >            {
> >                mapper.Generate().Save(mapper.FileName);
>
> >            }
>
> > Each map I want to write out implements IMapGenerator
>
> > public XmlDocument Generate()
> >        {
> >            return CreateMapping(new MappingVisitor());
> >        }
>
> > IMapGenerator code:
>
> > public interface IMapGenerator
> >    {
> >        string FileName { get; }
> >        XmlDocument Generate();
> >     }
>
> > On Jan 8, 10:05 am, "James Gregory" <jagregory....@gmail.com> wrote:
> > > As Andrew said, the PersistenceModel has a WriteMappingsTo(string
> > folder)method.
>
> > > On Thu, Jan 8, 2009 at 4:03 PM, Mart Leet <mal...@gmail.com> wrote:
> > > > To see my xml in testexplorer i created
> > this:Console.Write(XElement.Parse(CreateMapping(new
> > > > MappingVisitor()).FirstChild.NextSibling.InnerXml,
> > > > LoadOptions.PreserveWhitespace).ToString());
>
> > > > Not much, but readable...
>
> > > > On Thu, Jan 8, 2009 at 5:57 PM, Troy Goode <troygo...@gmail.com>
> > wrote:
>
> > > >> I know from my recent foray into automapping that I can see what the
> > > >> XML produced by the automapper is using:
>
> > > >> automapper.WriteMappingsTo("folderpath");
>
> > > >> What is the easiest way to accomplish the same thing (see the
> > > >> generated XML) when using ClassMap<T>?
--~--~---------~--~----~------------~-------~--~----~
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