Ohhh, cheers James! Well hopefully that will sort Francisco out then. Francisco, another possible option occured to me. Instead of using automapping overrides, you could use a IPropertyConvention that tests to see if the property is called ModifiedAt and if so maps it as a Version mapping.
On Wed, Oct 7, 2009 at 10:10 PM, James Gregory <jagregory....@gmail.com>wrote: > AFAIK <timestamp /> == <version type="timestamp" /> > Timestamp in > docs<http://www.nhforge.org/doc/nh/en/index.html#mapping-declaration-timestamp> > at > the bottom says "Note that <timestamp> is equivalent to <version > type="timestamp">." > > > On Wed, Oct 7, 2009 at 12:01 PM, Paul Batum <paul.ba...@gmail.com> wrote: > >> There are a number of problems at play here. The first problem is that >> because the property is a datetime, the automapper doesn't know that you >> want to map it as a version column, and that means your IVersionConvention >> isn't applied. >> To get the convention applied, you could implement an automapping override >> (see the wiki <http://wiki.fluentnhibernate.org/Auto_mapping> for more >> info) that calls Version(x => x.ModifiedAt). Unfortunately, that won't >> create a <timestamp> mapping. It will make one of these: >> >> <version name="ModifiedAt" type="timestamp"> >> <column name="ModifiedAt" /> >> </version> >> >> I've double checked the FNH source code, and it looks like we don't have >> any support for the <timestamp> element. You may have to look at using some >> sort of <version> based alternative. >> >> >> On Thu, Oct 1, 2009 at 11:34 PM, Francisco Lozano <floz...@gmail.com>wrote: >> >>> >>> Hi, >>> >>> I've just discovered fluent nhibernate and i'm trying to make it work >>> for me. >>> >>> Right now I'm using automap and it works great. I've been able to >>> adapt it to my needs for everything but one thing: versions. I have a >>> Entity base class that has a DateTime ModifiedAt version. >>> >>> When I used hbm.xml files I mapped it with <timestamp >>> name="ModifiedAt" />, but I don't know hot to do it with automappings. >>> >>> I've tried with IVersionConvention but I can't figure out how to use >>> it. ¿Any hint? >>> >>> My current automap config looks like this: >>> >>> _config = Fluently.Configure() >>> .Database( >>> >>> MsSqlConfiguration.MsSql2008.ConnectionString( >>> c => c.FromConnectionStringWithKey >>> ("Db") >>> ) >>> .AdoNetBatchSize(20) >>> .CurrentSessionContext("web") >>> .ProxyFactoryFactory(typeof >>> (NHibernate.ByteCode.LinFu.ProxyFactoryFactory)) >>> ) >>> .Mappings( >>> m => m.AutoMappings.Add( >>> AutoMap.AssemblyOf<AppUser>() >>> .IgnoreBase<Entity>() >>> .IgnoreBase<EntityType>() >>> .IgnoreBase<EntityWithName>() >>> .Conventions.Add<IdGenerationConvention> >>> () >>> >>> .Conventions.Add<DefaultStringLengthConvention> >>> () >>> >>> .Conventions.Add<CustomForeignKeyConvention> >>> () >>> .Conventions.Add<NotNullConvention>() >>> .Conventions.Add<CascadeAllConvention> >>> () >>> >>> .UseOverridesFromAssemblyOf<AppUserOverride> >>> () >>> >>> ) >>> ) >>> .BuildConfiguration(); >>> >>> >>> >> >> >> > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---