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
-~----------~----~----~----~------~----~------~--~---

Reply via email to