Seems to work now. Thanks James. James Gregory schrieb: > Guys, I've committed a fix for this in master; along with the fix I've also > made the automapper predict the generator like the fluent mappings do, can't > believe it didn't do this to begin with :( > > On Mon, Aug 17, 2009 at 7:47 PM, Steve Wagner <[email protected]> wrote: > >> Hi James, it seems this is a bug in current git master. I stumbled upon >> the same problem. The IdConvention is called but the call to >> >> instance.GeneratedBy.GuidComb() >> >> fails because, inside of this function in GeneratorInstance.cs this if >> >> if (!mapping.IsSpecified(x => x.Class)) >> >> returns false and so is the builder never called. But i dose not found >> why this is already specified. >> >> My mapping looks like this: >> >> return AutoMap.AssemblyOf<User>() >> .Where( t => t.BaseType != null && IsDomainEntityBase( >> t.BaseType ) ) >> .Conventions.Add<GuidCombIdConvention>() >> .Conventions.Add<UseDynamicInsertAndUpdateConvention>() >> .Conventions.Add<IntEnumerationPropertyConvention>() >> .Setup( c => >> { >> c.FindIdentity = ( info => info.Name == "Id" ); >> } ); >> >> and the convention looks like this: >> >> public class GuidCombIdConvention : IIdConvention >> { >> /// <summary> >> /// Applies the specified target. >> /// </summary> >> /// <param name="target">The target.</param> >> public void Apply( IIdentityInstance target ) >> { >> target.GeneratedBy.GuidComb(); >> } >> } >> >> Steve >> >> James Gregory schrieb: >>> That definitely looks like a bug. Ids of Guid should always default to >>> GuidComb, so something weird's happening there anyway, but you should be >>> able to override it anyway! Filed, I'll look at it tonight. >>> >>> On Mon, Aug 17, 2009 at 1:11 PM, [email protected] < >>> [email protected]> wrote: >>> >>>> Hello, >>>> >>>> lets start with some code, here is my setup: >>>> >>>> mappingConfiguration.AutoMappings.Add(AutoMap >>>> .AssemblyOf<User>() >>>> >>>> .UseOverridesFromAssemblyOf<User>() >>>> >>>> .Conventions.AddFromAssemblyOf<User>() >>>> .Where(t => typeof >>>> (IEntity).IsAssignableFrom(t) && >>>> t.IsClass) >>>> >>>> here is my Id Convention >>>> >>>> public class IdConvention : IIdConvention, IIdConventionAcceptance >>>> { >>>> public void Accept(IAcceptanceCriteria<IIdentityInspector> >> criteria) >>>> { >>>> criteria.Expect(c => c.Property.PropertyType == >> typeof(Guid) >>>> && >>>> c.Property.Name.ToUpper() == "ID"); >>>> } >>>> >>>> public void Apply(IIdentityInstance instance) >>>> { >>>> instance.GeneratedBy.GuidComb(); >>>> } >>>> } >>>> >>>> with or without the conventions in place, my Id mappings end up like >>>> this: >>>> >>>> <id name="Id" type="System.Guid, mscorlib, Version=2.0.0.0, >>>> Culture=neutral, PublicKeyToken=b77a5c561934e089"> >>>> <column name="Id" /> >>>> <generator class="identity" /> >>>> </id> >>>> >>>> With the convention in place, the Apply() method is run on my >>>> entities, but the xml remains the same :( >>>> >>>> to further debug, i tried this: >>>> >>>> public void Apply(IIdentityInstance instance) >>>> { >>>> instance.GeneratedBy.GuidComb(); >>>> instance.Column("wibble"); >>>> } >>>> >>>> which ends up as: >>>> >>>> <id name="Id" type="System.Guid, mscorlib, Version=2.0.0.0, >>>> Culture=neutral, PublicKeyToken=b77a5c561934e089"> >>>> <column name="wibble" /> >>>> <generator class="identity" /> >>>> </id> >>>> >>>> Bug? or am i being daft (highly probable) >>>> >>>> Andrew >>>> > > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Fluent NHibernate" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/fluent-nhibernate?hl=en -~----------~----~----~----~------~----~------~--~---
