views:

152

answers:

2

I have a class that contains a collection of enumeration as follows.

public enum TransactionType
{
  ...
}

public class PaymentMethod
{
  ...
  public virtual IList<TransactionType> SupportedTransactionTypes { get; set; }
}

Other references to the TransactionType enumeration are working correctly but with this collection I get an exception: "Association references unmapped class".

Looking around it seems like I needed to specify

I have setup the following override mappings for the PaymentMethod class:

mapping.HasMany(x => x.TransactionTypes)
  .Element("TransactionTypeId"), x => x.Type<TransactionType>());

But this causes the following exception...

Validation failed: System.NullReferenceException: Object reference not set to an instance of an object. at FluentNHibernate.Conventions.Inspections.OneToManyInspector.get_Class() in e:\horn.horn\orm\fluentnhibernate\Working\src\FluentNHibernate\Conventions\Inspections\OneToManyInspector.cs:line 40 at FluentNHibernate.Conventions.ProxyConvention.Apply(ICollectionInstance instance) in e:\horn.horn\orm\fluentnhibernate\Working\src\FluentNHibernate\Conventions\ProxyConvention.cs:line 79 at FluentNHibernate.Visitors.ConventionVisitor.Apply[TInspector,TInstance](IEnumerable conventions, TInstance instance) in e:\horn.horn\orm\fluentnhibernate\Working\src\FluentNHibernate\Visitors\ConventionVisitor.cs:line 269 at ...

I have tried a lot of different variations on the mapping, including TableName, KeyColumn and anything else I can think of but I can't get this mapping to work.

Any help appreciated...

A: 

I dont think you can map a collection of enums. You certainly couldnt a year or so ago

Steve

related questions