Here is the answer: http://mortslikeus.blogspot.com/2009/06/understand-activerecord-mapping.html
Enjoy reading! -Markus 2009/6/2 CVertex <[email protected]>: > > Hi Markus, > > Are you saying what I'm asking is not possible? Or are you agreeing > with Jonathon? I was confused as you responded to Jonathon. > > I tried setting ElementType = typeof(int), but it threw the same > exception, so I'll assume you agreed with Jon. > > Thanks, > CV > > > > On Jun 2, 3:58 am, Markus Zywitza <[email protected]> wrote: >> Not really, you can also use collections of simple types etc. Check >> the Element and ElementType properties of the HasMany-attribute. >> >> -Markus >> >> 2009/6/1 Jonathon Rossi <[email protected]>: >> >> > Role would have to be an ActiveRecord class to be used with HasMany. >> >> > Think about how you'd do this in the database. The first case works because >> > it is just a column in the Person table storing a single int or string for >> > the enum value. >> >> > On Mon, Jun 1, 2009 at 1:22 AM, CVertex <[email protected]> wrote: >> >> >> I have a role enum >> >> public enum Role >> >> { >> >> User,Administrator >> >> } >> >> >> And I can add a property to a record type, >> >> >> [ActiveRecord] >> >> public class Person{ >> >> [PrimaryKey(PrimaryKeyType.Identity)] >> >> public virtual int Id { get; set; } >> >> >> [Property()] >> >> public virtual Role PersonRole { get; set; } >> >> >> } >> >> >> but how do I add a property of IList<Role> to Person to represent a >> >> Person having many Roles? >> >> >> [HasMany] >> >> public virtual IList<Role> Roles { get; set; } >> >> >> when I run this, I get >> >> >> "ActiveRecord tried to infer details about the relation Person.Roles >> >> but it could not find information about the specified target type >> >> Kk.Console.Role. If you have mapped a Collection or Dictionary of >> >> value types, please make sure you have specified the Table property." >> >> >> Is this something I can model in AR? >> >> > -- >> > Jono > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
