I should've caught that in the first place, but your original convention
threw me. You'd never have a ClassMap<Enum>, so you'd never have a
IClassConvention for one.

On Wed, Aug 19, 2009 at 11:25 AM, James Gregory <[email protected]>wrote:

> I just had a look at that code, it's using the wrong convention.
> IPropertyConvention is what you'll need, and in that case you'd use
> CustomType for changing it's type.
>
>
> On Wed, Aug 19, 2009 at 10:41 AM, Richard Evans <[email protected]
> > wrote:
>
>>
>> Okay, just tried this and it doesn't compile, there is no setter for
>> EntityType on IClassInstance.
>>
>> I'll have a dig around and see if there is a different way.
>>
>> Cheers.
>>
>> On Aug 18, 11:04 pm, Jim Tanner <[email protected]> wrote:
>> > No problem, glad to have benn helpfull.
>> >
>> > On 18 août, 22:57, Richard Evans <[email protected]> wrote:
>> >
>> > > i did try but i never thought to implement the
>> > > IClassConventionAcceptance interface. It was obvious that there was a
>> > > method missing from the interface but I couldn't work out which
>> > > interface I needed to implement. It's obvious now.
>> >
>> > > Thanks for the suggestion and code sample, much appreciated.
>> >
>> > > On Aug 18, 4:41 pm, Jim Tanner <[email protected]> wrote:
>> >
>> > > > I had the same problem yesterdayhttp://
>> groups.google.com/group/fluent-nhibernate/browse_thread/thread...
>> >
>> > > > Try this
>> >
>> > > > public class EnumerationTypeShouldBeIntegerNotStringConvention
>> > > >   : IClassConvention, IConventionAcceptance<IClassInspector>
>> > > >     {
>> > > >         public void Accept(IAcceptanceCriteria<IClassInspector>
>> > > > criteria)
>> > > >         {
>> > > >             criteria.Expect(x => x.GetType() == typeof(Enum));
>> > > >         }
>> >
>> > > >         void IConvention<IClassInspector, IClassInstance>.Apply
>> > > > (IClassInstance instance)
>> > > >         {
>> > > >             instance.EntityType = typeof(int);
>> > > >         }
>> > > >     }
>> >
>> > > > Documentation can be found herehttp://
>> wiki.fluentnhibernate.org/Conventions
>> > > > and herehttp://
>> wiki.fluentnhibernate.org/Conventions#Conditional_applying_of_...
>> >
>> > > > On 18 août, 16:29, Richard Evans <[email protected]> wrote:
>> >
>> > > > > We've got a convention that I'd like to port to RC1. Any
>> suggestions
>> > > > > for the best way to migrate this?
>> >
>> > > > > public class EnumerationTypeShouldBeIntegerNotStringConvention :
>> > > > > IClassConvention
>> > > > >     {
>> > > > >         public bool Accept(IClassMap target)
>> > > > >         {
>> > > > >             return target.GetType() == typeof(Enum);
>> > > > >         }
>> >
>> > > > >         public void Apply(IClassMap target)
>> > > > >         {
>> > > > >             target.SetAttribute("type", "int");
>> > > > >         }
>> >
>> > > > > }
>> >>
>>
>

--~--~---------~--~----~------------~-------~--~----~
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