The problem with your approach is that typeof(AnglePerTime) !=
typeof(IMeasurement)
What you want to use instead is Type.IsAssignableFrom:

.WithSetup(s =>  s.IsComponentType = type =>
typeof(IMeasurement).IsAssignableFrom(type))

Give that a go.

Paul Batum

On Mon, Jul 20, 2009 at 11:16 PM, Charles <[email protected]> wrote:

>
> Hei -
> I have a working solution, but am wondering if there are any good tips
> for improvement.
>
> I have many measurement classes, all of which implement IMeasurable
> interface, and all of which should be components.
>
> So the obvious is that I should be able to automap my components with:
>
> .WithSetup(s =>  s.IsComponentType = type => type == typeof
> (IMeasurement))
>
> But I have only succeeded using:  (listing every component class
> seperately)
>
>                .WithSetup(s =>
>                {
>                    s.IsComponentType = type => type == typeof
> (Dimensionless) ||
>                                                type == typeof
> (AnglePerTime) ||
>                                                type == typeof
> (Velocity) ||
>                                                type == typeof
> (Frequency) ||
>                                                .
>                                                .
>                                                .
>                                                type == typeof
> (VolumeFlowRate);
>                    s.GetComponentColumnPrefix = type => type.Name +
> "_";
>                })
>
> This problem may well repeat itself when I try to ignore some of the
> IMeasurement properties, so any suggestions are appreciated.
>
> Regards,
> charles
>
> >
>

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