I could provide a sample if you want to see it - but if CompileMappings puts them all somewhere where WriteMappingsTo can actually write them out pre-configure, I should be good to go.
On Feb 1, 4:53 pm, Andrew Stewart <andrew.stew...@i-nnovate.net> wrote: > Hi > > I understood what you meant, but I couldnt get it to fall over on hitting > the configure command. > > Either way give this a go. > > var mappings = AutoPersistenceModel > .MapEntitiesFromAssemblyOf<Product>() > .Where(GetEntityFilter) > .WithConvention(GetConventions) > .CompileMappings(); > > That should build the all the mappings up so you can run the usual way of > writing out the mapping files. > > Andy > > > > On Fri, Jan 30, 2009 at 5:13 PM, Jay Oliver <kyth...@gmail.com> wrote: > > > I'm not sure if I was clear enough. I'm doing something like this: > > > var mappings = AutoPersistenceModel > > .MapEntitiesFromAssemblyOf<Product>() > > .Where(GetEntityFilter) > > .WithConvention(GetConventions); > > > var sessionFactory = new Configuration() > > .AddProperty(ConnectionString, ApplicationConnectionString) > > .AddAutoMappings(mappings) > > .BuildSessionFactory(); > > > AddAutoMappings is just an extension method which effectively calls > > mappings.Configure(cfg). This is the point where an exception is > > raises if the mappings are bad. > > > My problem (and it may be completely user error) is that when the > > AutoPersistenceModel builds mappings that NHib's Configuration object > > doesn't like, I cannot actually look at the XML mappings to see if I > > can spot what the error might be. > > > I tried calling mappings.WriteMappingsTo(), but that only seems to > > write out ones that I have used ForTypesThatDeriveFrom<T> on. Ones > > that were completely automapped by convention don't seem to be written > > out until after I call Configure. From what I can tell, this is > > because they're not put into the collection that WriteMappingsTo > > iterates over until after AutoPersistenceModel.Configure(cfg) is > > called. The catch 22 here is that this prevents me from looking at > > them during one of the only times I want to do so. > > > Am I doing this wrong? Missing something obvious? Is there another way > > to inspect the mappings? > > > On Jan 30, 10:31 am, Andrew Stewart <andrew.stew...@i-nnovate.net> > > wrote: > > > Hi > > > Is there any reason you can't configure the model then output the > > mapping, > > > personally I don't seem to be able to make it break before the configure > > is > > > called. > > > > Andy > > > > On Wed, Jan 28, 2009 at 11:35 PM, Jay Oliver <kyth...@gmail.com> wrote: > > > > > That doesn't seem to be happening for me, but it'd be thrilling if > > > > there was a way to turn it on. > > > > > On Jan 28, 2:49 pm, Andrew Stewart <andrew.stew...@i-nnovate.net> > > > > wrote: > > > > > Hi Jay > > > > > Dont quote me on this but I think if you configure you model inside a > > > > nunit > > > > > test you ca see the mappings in output. > > > > > I'm away from the source at the mo, let me know if that doesnt solve > > your > > > > > problem and I'll boot the source up and have a play > > > > > > Cheers > > > > > > Andy > > > > > > On Wed, Jan 28, 2009 at 5:36 PM, Jay Oliver <kyth...@gmail.com> > > wrote: > > > > > > > I'm playing around with the AutoPersistenceModel, and I like it a > > good > > > > > > deal. > > > > > > > I've been doing a lot of tweaking conventions to try to get it just > > > > > > right, and keep running into the same problem: When a mapping is > > > > > > produced that NHibernate doesn't like, I have no way to see the XML > > of > > > > > > that mapping. > > > > > > > I've tried calling WriteMappingsTo, but in the case of the > > > > > > AutoPersistenceModel, it seems that they're not actually created / > > > > > > added to the collection until after Configure is called. Seems like > > a > > > > > > bit of a catch 22 - I can only get the mappings when there are no > > > > > > issues with them. > > > > > > > Is there something I'm missing? It would make tweaking my > > conventions > > > > > > much easier if I could actually see the results. > > > > > > -- > > > > > ================= > > > > > I-nnovate Software - Bespoke Software Development, uk wirral. > > > >http://www.i-nnovate.net > > > > -- > > > ================= > > > I-nnovate Software - Bespoke Software Development, uk wirral. > >http://www.i-nnovate.net > > -- > ================= > 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 -~----------~----~----~----~------~----~------~--~---