I'd imagine your Where(x => true) will be causing problems, as it'll try to map everything in there.
On Wed, Mar 4, 2009 at 7:32 PM, aemami <aemam...@gmail.com> wrote: > > Hi Ramana, thank you for the reply. > > I am getting the following error: > > {"Late bound operations cannot be performed on types or methods for > which ContainsGenericParameters is true."} > > When trying to do the following: > > private ISessionFactory CreateSessionFactory<T>() > { > AutoPersistenceModel mappings = AutoPersistenceModel > .MapEntitiesFromAssemblyOf<T>() > .Where(x => true) > .WithConvention(new > PascalToUnderscorePropertyConvention()); > > return Fluently.Configure() > .Database(MySQLConfiguration.Standard > .ConnectionString(c => c.Is(cm.ConnectionString)) > .Provider<DriverConnectionProvider>() > .Driver<MySqlDataDriver>() > .Dialect<MySQLDialect>() > .ShowSql()) > .Mappings(m => m > .FluentMappings.AddFromAssemblyOf<T>()) > .Mappings(m => m.AutoMappings.Add(mappings)) > .BuildSessionFactory(); > } > > And I changed my mapping class to do this: > > public class LevelingTableMap : ClassMap<LevelingTable> > { > public LevelingTableMap() > { > WithTable("leveling_table"); > Id(x => x.Id).TheColumnNameIs("leveling_table_id"); > } > } > > > > On Mar 4, 7:49 am, Ramana Kumar <ramana.r.ku...@gmail.com> wrote: > > Hi aemami > > Please look at the solution in the threadhttp:// > groups.google.com/group/fluent-nhibernate/browse_thread/thread... > > . > > I had put out a solution to the exact same problem. > > HTH > > Ramana > > > > On Wed, Mar 4, 2009 at 6:18 AM, James Gregory <jagregory....@gmail.com > >wrote: > > > > > There's nothing in FNH to do the actual name conversion, but you could > > > create an ITypeConvention implementation< > http://wiki.fluentnhibernate.org/show/AutoMappingTypeConventions>which > would handle your properties - you'd just need to handle the ids. > > > public class ColumnNameConvention : ITypeConvention > > > { > > > public bool CanHandle(Type type) > > > { > > > return true; > > > } > > > > > public void AlterMap(IProperty propertyMapping) > > > { > > > var newName = propertyMapping.Property.Name< > http://propertymapping.property.name/> > > > ; > > > > > newName = // something here to convert > > > > > property.ColumnName(newName); > > > } > > > } > > > > > You'd just need to figure out an algorithm for converting your names. > > > Probably split on a capital letter and replace with an underscore, then > > > lowercase it. > > > > > On Wed, Mar 4, 2009 at 9:00 AM, Andrew Stewart < > andrewnstew...@gmail.com>wrote: > > > > >> Hi > > >> Unless someone can point to something I don't know about then the > column > > >> name is always mapped to the property name. But please put this in the > > >> defect log(I'm hoping there's a feature request section) or we're > always > > >> welcome to recieve a patch. To patch this you'd have to modify the > > >> PropertyMap class to take the column name from the convention class. > > > > >> Cheers > > > > >> Andy > > > > >> On Wed, Mar 4, 2009 at 3:25 AM, aemami <aemam...@gmail.com> wrote: > > > > >>> Hi, Fluent NHibernate is what finally made me decide to switch over > to > > >>> NHibernate as my ORM, so, good job :) > > > > >>> My question is this: > > > > >>> Is there an easy way to add your mappings if every single Class has > > >>> its properties formatted consistently based on its column name? > > > > >>> My convention is this: > > > > >>> db_column_name => DbColumnName (in other words I remove the > > >>> underscores and capitalize the first letter of each word) > > > > >>> Is this some supported way in the NHibernate Fluent project to be > able > > >>> to do infer this naming convention automatically, without me having > to > > >>> type every mapping by hand? > > > > >>> I want to avoid having to type this for 60+ classes (especially since > > >>> its the exact same naming convention for every darn class!!) > > > > >>> public LevelingTableMap() > > >>> { > > >>> WithTable("leveling_table"); > > >>> Id(x => x.Id).TheColumnNameIs("leveling_table_id"); > > >>> Map(x => x.Level).ColumnName("level"); > > >>> Map(x => x.ExpNeeded).ColumnName("exp_needed"); > > >>> Map(x => x.LevelFreeOrPaid).ColumnName > > >>> ("level_free_or_paid"); > > >>> Map(x => x.GeneralistAirLevel).ColumnName > > >>> ("generalist_air_level"); > > >>> Map(x => x.GeneralistOllieLevel).ColumnName > > >>> ("generalist_ollie_level"); > > >>> Map(x => x.GeneralistSpinLevel).ColumnName > > >>> ("generalist_spin_level"); > > >>> Map(x => x.GeneralistBalanceLevel).ColumnName > > >>> ("generalist_balance_level"); > > >>> Map(x => x.VertAirLevel).ColumnName("vert_air_level"); > > >>> Map(x => x.VertOllieLevel).ColumnName("vert_ollie_level"); > > >>> Map(x => x.VertSpinLevel).ColumnName("vert_spin_level"); > > >>> Map(x => x.VertBalanceLevel).ColumnName > > >>> ("vert_balance_level"); > > >>> Map(x => x.StreetAirLevel).ColumnName("street_air_level"); > > >>> Map(x => x.StreetOllieLevel).ColumnName > > >>> ("street_ollie_level"); > > >>> Map(x => x.StreetSpinLevel).ColumnName > > >>> ("street_spin_level"); > > >>> Map(x => x.StreetBalanceLevel).ColumnName > > >>> ("street_balance_level"); > > >>> Map(x => x.FreestyleAirLevel).ColumnName > > >>> ("freestyle_air_level"); > > >>> Map(x => x.FreestyleOllieLevel).ColumnName > > >>> ("freestyle_ollie_level"); > > >>> Map(x => x.FreestyleSpinLevel).ColumnName > > >>> ("freestyle_spin_level"); > > >>> Map(x => x.FreestyleBalanceLevel).ColumnName > > >>> ("freestyle_balance_level"); > > >>> } > > > > >> -- > > >> ================= > > >> I-nnovate Software - Bespoke Software Development, uk wirral. > > >>http://www.i-nnovate.net > > > > >> Easy Project Managment Online > > >>http://www.task-mate.com > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---