Hello!
This is my first post on Stack Overflow! (yay!)
I'm having trouble with a Castle ActiveRecord mapping, which I thought would be a pretty common scenario, but maybe I didn't "google" right.
I have one entity called Product, and another entity called Warranty. Product has two properties on it (among others), each of type Warranty. So the model looks something like this (attributes and other properties are omitted):
public class Product
{
...
public Warranty StandardWarranty { get; set; }
public Warranty ExtendedWarranty { get; set; }
}
public class Warranty
{
...
public Product Product { get; set; }
}
At first I thought that I would need to make warranty a base class and then create two concrete classes, StandardWarranty and ExtendedWarranty, but the classes do not diverge in any kind of data or behavior, so using a single table inheritence with a discriminator column seemed overkill and over complex.
The closest thing I could come up with in the ActiveRecord documentation would be to use the "Any" attribute. But the documentation seemed to hint that it should be used in scenarios where there is polymorphic behavior involved with separate concrete classes. But I wanted to check with the community before I started winding down that rabbit hole.
Perhaps I should just use a one to many relationship instead? One product has many warranties? But the product class will have at most 2 and at least 0, so this still didn't seem correct.
Any input would be helpful!
Thanks, Matt