views:

131

answers:

1

Is it possible to persist an IList<DayOfWeek> using nHibernate?

public class Vendor
{
    public virtual IList<DayOfWeek> OrderDays { get; private set; }
}

If not, what are some common solutions; creating a class for OrderDays?, using an IList<string>?

+1  A: 

Of course it's possible...

<bag name="OrderDays">
  <key column="VendorId" />
  <element type="System.DayOfWeek" />
</bag>

VendorId would be the FK column to Vendor in the OrderDays table (you can customize all of that)

Diego Mijelshon
Thanks. If anyone else is looking, the fluent version is as follows: HasMany(x => x.OrderDays).Element("DayOfWeek")
Charlie Brown