I must be missing something small-- I have a "feedback" class that can
be given to either a user or a team.  The mapping is like this:

[ActiveRecord]
public class Team : ModelBase<Team>, IFeedbackRecipient
{
  [HasMany(typeof(WorkerFeedback), Table = "WorkerFeedback", ColumnKey
= "RecipientID", Lazy=true)]
  private IList<WorkerFeedback> FeedbacksReceived{get;set;}
}

[ActiveRecord]
public class User: ModelBase<User>, IFeedbackRecipient
{
  [HasMany(typeof(WorkerFeedback), Table = "WorkerFeedback", ColumnKey
= "RecipientID", Lazy=true)]
  private IList<WorkerFeedback> FeedbacksReceived{get;set;}
}

[ActiveRecord]
public class WorkerFeedback : ModelBase<WorkerFeedback>
{
  [Any(typeof(int), MetaType = typeof(string), TypeColumn =
"RecipientType", IdColumn = "RecipientID", Cascade =
CascadeEnum.SaveUpdate)]
  [Any.MetaValue("USER", typeof(User))]
  [Any.MetaValue("TEAM", typeof(Team))]
  public IFeedback Recipient
  {
    get { return _recipient; }
    set { _recipient = value; }
  }
}

If I do a test, create a couple of WorkerFeedback instances and assign
them to a team, I can see the data added to my WorkerFeedback table.
But the RecipientType column is null instead of having "TEAM" as I'd
expect.

Can someone point out my mistake?

--

You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to castle-project-us...@googlegroups.com.
To unsubscribe from this group, send email to 
castle-project-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=.


Reply via email to