No worries, Ive made the change and included it. Its now on my dev branch which you can see here: http://github.com/paulbatum/fluent-nhibernate/tree/dev
<http://github.com/paulbatum/fluent-nhibernate/tree/dev>It should make its way into the trunk before too long. Thank you for your contribution Martin. On Sun, Jun 27, 2010 at 4:33 PM, Martin Nilsson <mffmar...@gmail.com> wrote: > Yes, that's correct. Sorry about that. Should I change it and do a new > request or how does it work. > > On Sunday, June 27, 2010, Paul Batum <paul.ba...@gmail.com> wrote: > > Hi Martin, > > > > I'm processing your pull request today. It all looks good, except I am > > guessing that there is a copy and paste error in the specs. > > > > Here's the spec: > > > > public class > > > when_changing_the_behaviour_of_automapping_configuration_to_also_map_nested_entities > > { > > Establish context = () => > > mapper = AutoMap.Source( > > new StubTypeSource(typeof(Order), > > typeof(Order.OrderLine)), new TestConfiguration()); > > > > Because of = () => > > mappings = mapper.BuildMappings() > > .SelectMany(x => x.Classes); > > > > It should_map_the_entity = () => > > mappings.ShouldContain(x => x.Type == typeof(Order)); > > > > It should_not_automap_the_nested_entity_per_default = () => > > mappings.ShouldContain(x => x.Type == > > typeof(Order.OrderLine)); > > > > static AutoPersistenceModel mapper; > > static IEnumerable<ClassMapping> mappings; > > > > class TestConfiguration : DefaultAutomappingConfiguration > > { > > public override bool ShouldMap(Type type) > > { > > return base.ShouldMap(type) || type.IsNested; > > } > > } > > } > > > > Would it be fair to say that the spec > > "should_not_automap_the_nested_entity_per_default" should have a > > different name? I am thinking something like > > "should_automap_nested_entity_when_overridden". > > > > On Jun 22, 9:27 pm, James Gregory <jagregory....@gmail.com> wrote: > >> That's what I was thinking, yeah. Just move the functionality in to the > >> default configuration. > >> > >> Arguably those interface checks shouldn't be in the config, because I > can't > >> think of a situation where you'd ever want to map those classes (and > >> overriding the method would then re-include those classes)... however, > >> that's one for us to tackle I think. > >> > >> As for tests, this is pretty much a pure refactoring so I don't think > we'd > >> need much in the way of tests. Maybe something that verifies you can > >> override the defaults and include nested classes. > >> > >> > >> > >> On Tue, Jun 22, 2010 at 7:33 AM, Martin Nilsson <mffmar...@gmail.com> > wrote: > >> > Ok, I'll give it a shot. > >> > What about backward compatibility? I guess I can't just remove the > check > >> > IsNotInnerClass so one idea I have, after just skimming the source, is > to > >> > move it to DefaultAutomappingConfiguration.ShouldMap(Type type) > >> > >> > return !type.ClosesInterface(typeof(IAutoMappingOverride<>)) && > >> > !type.HasInterface(typeof(IMappingProvider)) && > >> > !IsInnerClass(type); > >> > >> > And then I have to override it in my CustomAutomappingConfiguration : > >> > DefaultAutomappingConfiguration > >> > >> > What do you think? As I said, this is nothing I have tested yet. > >> > >> > On Mon, Jun 21, 2010 at 10:26 PM, James Gregory < > jagregory....@gmail.com>wrote: > >> > >> >> This is by design. Arguably a bad design. If you want to use nested > >> >> classes you'll need to modify the FNH code (and preferably send us a > pull > >> >> request). > >> > >> >> Sent from my jelly bone > >> > >> >> On 21 Jun 2010, at 21:04, Martin Nilsson <mffmar...@gmail.com> > wrote: > >> > >> >> Anyone? > >> >> In AutoPersistenceModel.CompileMappings at row 143 there is this > code: > >> > >> >> foreach (var type in mappingTypes) > >> >> { > >> >> if (!type.Type.IsClass || !IsNotInnerClass(type)) continue; > >> >> if (type.IsMapped) continue; > >> > >> >> AddMapping(type.Type); > >> >> } > >> > >> >> IsNotInnerClass seems to be the issue but I don't understand why. > >> > >> >> On Tue, Jun 15, 2010 at 8:13 AM, Martin Nilsson < < > mffmar...@gmail.com> > >> >> mffmar...@gmail.com> wrote: > >> > >> >>> Hi, > >> > >> >>> How do I auto map inner classes in FNH? > >> >>> If I change Employee in the Examples.FirstAutomappedProject to have > an > >> >>> inner class (Name) I get this exception: > >> > >> >>> "An association from the table Employee refers to an unmapped class: > >> >>> Examples.FirstAutomappedProject.Entities.Employee+Name" > >> > >> >>> namespace Examples.FirstAutomappedProject.Entities > >> >>> { > >> >>> public class Employee > >> >>> { > >> >>> public virtual int Id { get; private set; } > >> >>> public virtual Store Store { get; set; } > >> >>> public virtual Name EmployeeName { get; set; } > >> > >> >>> public class Name > >> >>> { > >> >>> public virtual string FirstName { get; set; } > >> >>> public virtual string LastName { get; set; } > >> >>> } > >> > >> >>> } > >> >>> } > >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > Groups > >> >> "Fluent NHibernate" group. > >> >> To post to this group, send email to > fluent-nhibern...@googlegroups.com. > >> >> To unsubscribe from this group, send email to > >> >> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > . > >> >> For more options, visit this group at > >> >>http://groups.google.com/group/fluent-nhibernate?hl=en. > >> > >> >> -- > >> >> You received this message because you are subscribed to the Google > Groups > >> >> "Fluent NHibernate" group. > >> >> To post to this group, send email to > fluent-nhibern...@googlegroups.com. > >> >> To unsubscribe from this group, send email to > >> >> fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com><fluent-nhibernate%2Bunsubscr > i...@googlegroups.com> > >> >> . > >> >> For more options, visit this group at > >> >>http://groups.google.com/group/fluent-nhibernate?hl=en. > >> > >> > -- > >> > You received this message because you are subscribed to the Google > Groups > >> > "Fluent NHibernate" group. > >> > To post to this group, send email to > fluent-nhibern...@googlegroups.com. > >> > To unsubscribe from this group, send email to > >> > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com><fluent-nhibernate%2Bunsubscr > i...@googlegroups.com> > >> > . > >> > For more options, visit this group at > >> >http://groups.google.com/group/fluent-nhibernate?hl=en. > > > > -- > > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > > To post to this group, send email to fluent-nhibern...@googlegroups.com. > > To unsubscribe from this group, send email to > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > . > > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. > > > > > > -- > You received this message because you are subscribed to the Google Groups > "Fluent NHibernate" group. > To post to this group, send email to fluent-nhibern...@googlegroups.com. > To unsubscribe from this group, send email to > fluent-nhibernate+unsubscr...@googlegroups.com<fluent-nhibernate%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/fluent-nhibernate?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to fluent-nhibern...@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.