Hi all, this is my first post.  I've been working with ActiveRecord
and NHibernate for about 6 months now so I hope I can contribute and
help others in the future but for now I'm having a little trouble.

I have an Address class that has subclasses of AddressReturn and
AddressCollection.  I am using the Single table inheritance pattern to
model these in ActiveRecord with an enum of AddressCategory acting as
the discriminator.  However I am having to hardcode the
DiscriminatorValue as it is looking for a constant and was wondering
if there was anyway to use the enum value as the discriminatorvalue?

Example of the classes below -

Address (Parent):
[code]
 [ActiveRecord(
      DiscriminatorColumn = "AddressCategoryId",
      DiscriminatorType = "integer",
      DiscriminatorValue = "3")]
    public class Address : Identified
[/code]

AddressReturn (Child):
[code]
[ActiveRecord(DiscriminatorValue = "1")]
    public class AddressReturn : Address
[/code]

AddressCategory (enum):
[code]
public enum JobAddressCategory
    {
        Collection = 1,
        Return = 2,
        Correspondence = 3
    }
[/code]

As you can see from the Address and AddressReturn class the
discriminatorValue is a string constant.  For the above example is
there anyway of doing something like:

AddressReturn (Child):
[code]
[ActiveRecord(DiscriminatorValue = (string)
AddressCategory.Collection)]
    public class AddressReturn : Address
[/code]

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" 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/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to