why not class FooAttribute : GeneralAttribute ... ?
On Sun, Dec 14, 2008 at 8:40 PM, Martin Nilsson <[email protected]> wrote: > Not really sure how I should model this. I have looked at the mapping > page<http://using.castleproject.org/display/AR/Mappings>but I don't know > which one to use. > > I have a class GeneralAttribute which looks, simplified, like this > > [ActiveRecord] > public class GeneralAttribute > { > private Guid id; > > [PrimaryKey(PrimaryKeyType.GuidComb, Access = > PropertyAccess.NosetterCamelcase)] > public Guid Id > { > get { return id; } > set { id = value; } > } > > [Property(NotNull = true, Unique = true)] > public string Name { get; set; } > } > > This class/table contains all my attribute definitions. > Now I want to connect an attribute to another class. Something like this > > [ActiveRecord] > public class Foo > { > [HasMany(Cascade = ManyRelationCascadeEnum.SaveUpdate)] > public IList<FooAttribute> AdditionalAttributes { get; private set; } > } > > [ActiveRecord] > public class FooAttribute > { > private Guid id; > > [PrimaryKey(PrimaryKeyType.GuidComb, Access = > PropertyAccess.NosetterCamelcase)] > public Guid Id > { > get { return id; } > set { id = value; } > } > > [????] > public GeneralAttribute AttributeInfo { get; set; } > > [BelongsTo(Type = typeof(Foo), NotNull = false)] > public Foo Foo { get; set; } > } > > What should the custom attribute for FooAttribute.AttributeInfo be? I want > to define my attributes in one table and point the records in FooAttribute > to that table so that table GeneralAttribute only contains Id and Name > columns, it doesn't know anything about FooAttribute. > > > > -- Ken Egozi. http://www.kenegozi.com/blog http://www.delver.com http://www.musicglue.com http://www.castleproject.org http://www.gotfriends.co.il --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
