Okay, its not as bad as I thought. The usage is:

public class IdConvention : IIdConvention
   {
       public void Apply(IIdentityInstance instance)
       {
           instance.GeneratedBy.Custom<MyCustomGenerator>();
       }
   }

On Sun, Feb 7, 2010 at 9:36 PM, Paul Batum <[email protected]> wrote:

> Argh, disregard that, its not quite that easy. I'll try to get back with a
> proper answer soon.
>
>
> On Sun, Feb 7, 2010 at 9:34 PM, Paul Batum <[email protected]> wrote:
>
>> Looks like an oversight. There's an easy fix, if you're comfortable with
>> changing your FNH build. Basically the IGeneratorInstance interface needs to
>> declare these members:
>>
>>         void Custom<T>() where T : IIdentifierGenerator;
>>         void Custom(Type generator);
>>         void Custom(string generator);
>>         void Custom<T>(Action<ParamBuilder> paramValues) where T :
>> IIdentifierGenerator;
>>         void Custom(Type generator, Action<ParamBuilder> paramValues);
>>         void Custom(string generator, Action<ParamBuilder> paramValues);
>>
>> The GeneratorInstance class already has an implementation for these -
>> they're just not declared on the interface. Once you put those declarations
>> in, you should be able to use:
>>
>> public class IdConvention : IIdConvention
>>    {
>>        public void Apply(IIdentityInstance instance)
>>        {
>>            instance.Generator.Custom<MyCustomGenerator>();
>>        }
>>    }
>>
>> I'll be committing this change to my repository and it should work its way
>> to the official trunk in a few days.
>>
>> On Thu, Feb 4, 2010 at 10:18 PM, Chris <[email protected]> wrote:
>>
>>> Hey All,
>>>
>>> All the tables in out database share a custom Id creation mechanism
>>> (there is a UDF called GetNextId()).  Now I can write up a custom id
>>> generator for NHibernate easily enough but I'm having difficulty
>>> setting it as the convention for my fluent mappings.  Do I have to
>>> patch the conventions stuff as it seems that from the conventions you
>>> can;t select custom as an option at present
>>>
>>> Chris
>>>
>>> --
>>> 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]<fluent-nhibernate%[email protected]>
>>> .
>>> 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 [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.

Reply via email to