views:

133

answers:

1

I have a many-to-many relationship with surrogate key

The classes are: Insurer - InsurerSection - Section.

InsurerSection has one extra attribute: active : bool.

How do I access these bool property? Is it possible to have this property contained within the Insurer and Section objects or do I have to call something like:

InsurerSection.FindOne(Expression.Eq("Section", sectionObj)).Active;

The best would be to have a reference in Insurer and Section like:

Insurer item = new Insurer();
item.Active = true;

OR

Section item = new Section();
item.Active = true;

Is that possible? What options do I have?

Thanks! Jakub

A: 

When you say:

Insurer item = new Insurer();
item.Active = true;

which InsurerSection should be marked with active = true ?

Either use FindOne as you suggested or map the relationship as a map/dictionary (unfortunately ActiveRecord doesn't support index-many-to-many yet)

Mauricio Scheffer