PluralizedTablesPack don't pluralize any more....!!??

18 views
Skip to first unread message

aozora

unread,
Jan 3, 2012, 4:18:06 AM1/3/12
to codec...@googlegroups.com
Something strange happened, this is how I configure ConfORM:

         var orm = new ObjectRelationalMapper();
         var patternSet = new CoolPatternsAppliersHolder(orm);
         var mapper = new Mapper(orm, patternSet);

         // Set Id generation to HiLo
         orm.Patterns.PoidStrategies.Add(new HighLowPoidPattern(/*new { max_lo = 100 }*/));

         // map .NET4 ISet<T> as a NHibernate's set
         orm.Patterns.Sets.Add(mi => mi.GetPropertyOrFieldType().GetGenericIntercafesTypeDefinitions().Contains(typeof(ISet<>)));

         orm.Patterns.Sets.Add(new UseSetWhenGenericCollectionPattern());

         mapper.PatternsAppliers.Merge(new SafePropertyAccessorPack());
         mapper.PatternsAppliers.Merge(new OneToOneRelationPack(orm));
         mapper.PatternsAppliers.Merge(new OneToManyKeyColumnApplier(orm));
         mapper.PatternsAppliers.Merge(new BidirectionalManyToManyRelationPack(orm));
         mapper.PatternsAppliers.Merge(new BidirectionalOneToManyRelationPack(orm));
         mapper.PatternsAppliers.Merge(new CoolTablesAndColumnsNamingPack(orm));
         mapper.PatternsAppliers.Merge(new Arashi.Core.NHibernate.ConfOrm.PoidColumnNameApplier());
         mapper.PatternsAppliers.Merge(new TablePerClassPack());
         mapper.PatternsAppliers.Merge(new PluralizedTablesPack(orm, new EnglishInflector()));

Initially all went well, and the generated hbm mapping was perfect, than after I wrote some mapper.Customize<> for some entities, I saw that in the mappings there wasn't anymore any table="xxx" for each class, as the PluralizedTablesPack wasn't working any more.
I tryied to comment out all the mapper.Customize<>, but this don't change anything, ConfORM will not generate anymore any table pluralized in the mappings.

this is the mapping for a simple entity:
  <class name="Widget">
    <id name="Id" column="WidgetId" type="Int32">
      <generator class="hilo" />
    </id>
    <many-to-one name="Type" column="WidgetTypeId" not-null="true" />
    <many-to-one name="Site" column="SiteId" not-null="true" />
    <property name="Title" />
    <property name="PlaceHolder" />
    <property name="Position" />
    <map name="Settings" table="WidgetSettings" cascade="all">
      <cache usage="read-write" />
      <key column="WidgetId" />
      <map-key type="String" />
      <element column="Value" type="String" />
    </map>
  </class>

Any ideas please?

Fabio Maulo

unread,
Jan 15, 2012, 6:56:29 AM1/15/12
to codec...@googlegroups.com
Do the merge using the patternSet variable before instantiate the mapper instead use mapper.PatternsAppliers.
btw
CoolPatternsAppliersHolder includes  CoolTablesAndColumnsNamingPack and  PluralizedTablesPack overrides some of other packs.

Have a look to this
--
Fabio Maulo

aozora

unread,
Jan 16, 2012, 9:33:27 AM1/16/12
to codec...@googlegroups.com
Thank you very much Fabio, that worked.
Reply all
Reply to author
Forward
0 new messages