I've just been using overrides to handle this. I certainly would like to hear about it if anyone does find a way to do this with conventions. My expectation has been that the only way around the overrides is to make the necessary modifications to FNH directly, but I'd love to be proved wrong.
On Thu, Jan 14, 2010 at 3:00 AM, Ryan Kelley <rpkel...@gmail.com> wrote: > Yes, I can make it work as an override. But, my whole reasoning for > wanting to convert to AutoMapping was that I didn't want to have to > have a bunch of extra classes that defined each class and how to map > it. Granted, 1 line of override for a class vs. 12 lines in a ClassMap > is better, but it is still a friction point. > > On Jan 13, 9:29 am, tbushell <tbush...@bic.com> wrote: > > >in my fluent mappings I just had this: > > >HasMany(x => x.GetTeams()).Access.CamelCaseField > > >(Prefix.Underscore).Cascade.SaveUpdate(); > > > > I'm not clear - have you tried to get this working as an override? > > > > It's my impression that everything you can do in a mapping class can > > also be done as an override when automapping, but I can't speak for > > this specific case, > > > > Also, this is probably obvious to you, and it's a real hack on a bunch > > of levels, but if you really need to get something working quickly, > > you could make _teams public, i.e. > > > > public virtual IList<Team> TeamsBackingVariable { get; set; } > > > > and initialize it in the constructor. > > > > This way, the automapper would pick it up, but your other code that > > uses GetTeams and AddTeam methods would not have to change. > > > > But obviously, doing it as a convention would be much better. > > > > -Tom > > > > On Jan 12, 12:03 pm, Ryan Kelley <rpkel...@gmail.com> wrote: > > > > > I have been googling, and reading through some of the stuff on the > > > group and have been unable to find an answer to this question. I have > > > been converting from ClassMap files (Fluent Config) to where our > > > entire project is mostly AutoMapped. > > > > > Given a typical class in our project: > > > > > public class School > > > { > > > private IList<Team> _teams = new List<Team>(); > > > > > public IEnumerable<Team> GetTeams() > > > { > > > return _teams; > > > } > > > > > public void AddTeam(Team team) > > > { > > > // other business logic > > > _teams.Add(team); > > > } > > > > > } > > > > > in my fluent mappings I just had this: > > > HasMany(x => x.GetTeams()).Access.CamelCaseField > > > (Prefix.Underscore).Cascade.SaveUpdate(); > > > > > but with my Automappings, these are not picked up. Is there a way I > > > can set up a IHasManyConvention to look for these IEnumerable methods > > > and automap them with the strategy I would use in an override or > > > FluentMap? > > -- > 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.