If you don't plan on having a "Person" table (and objects), remove the ActiveRecord attribute and make the class abstract. Then just make sure you place an [ActiveRecord] attribute on Teacher and Student and you'll be all set.
--- Patrick Steele http://weblogs.asp.net/psteele On Tue, Apr 27, 2010 at 3:58 PM, Hernan <[email protected]> wrote: > I am trying to do this, One class person with common attributes, one > Teacher and one Student. Both inherit from Person. > In Database, I have created only two tables: Teacher and Student and > they both have the common columns. > How should I decorate my classes to make it work? > > [ActiveRecord] > public class Person: ActiveRecordBase<Person> > { > [PrimaryKey(PrimaryKeyType.Identity)] > public int Id{get; set;} > > [Property] > public string LastName > {get; set;} > } > > public class Teacher: Person > { > public decimal Salary > {get; set;} > } > > public class Student: Person > { > public string xxxx > {get; set;} > } > > Thanks! > > -- > 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. > > -- 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.
