That's what I'm trying to accomplish with the IProjectBidder interface
and the [Any] attribute.  The project bid may come from either a Team
or a User.

On Oct 13, 6:42 am, Patrick Steele <[email protected]> wrote:
> If a Team "HasMany" ProjectBid's, then the ProjectBid object needs a
> Team property to tie that bid to a particular Team.
>
> --
> Patrick Steelehttp://weblogs.asp.net/psteele
>
>
>
> On Mon, Oct 12, 2009 at 4:07 PM, JakeS <[email protected]> wrote:
>
> > I've got a system that allows either individual users or entire teams
> > to bid on projects.  I'm trying to model the relationship based on an
> > "IProjectBidder" relationship, but I'm missing something...
>
> > [ActiveRecord]
> > public class User: ModelBase<User>, IProjectBidder
> > {
> >  private IList<ProjectBid> _projectBids;
> >  [HasMany(typeof(ProjectBid), Lazy=true)]
> >  public IList<ProjectBid> ProjectBids
> >  {
> >    get
> >    {
> >        if(_projectBids==null){_projectBids=new List<ProjectBid>();}
> >        return _projectBids;
> >    }
> >    set { _projectBids = value; }
> >  }
> > }
>
> > [ActiveRecord]
> > public class Team: ModelBase<Team>, IProjectBidder
> > {
> >  private IList<ProjectBid> _projectBids;
> >  [HasMany(typeof(ProjectBid), Lazy=true)]
> >  public IList<ProjectBid> ProjectBids
> >  {
> >    get
> >    {
> >        if(_projectBids==null){_projectBids=new List<ProjectBid>();}
> >        return _projectBids;
> >    }
> >    set { _projectBids = value; }
> >  }
> > }
>
> > [ActiveRecord]
> > public class ProjectBid : ModelBase<ProjectBid>
> > {
> >    [Any(typeof(int),MetaType = typeof(string), TypeColumn =
> > "BidderType", IdColumn = "BidderID")]
> >    [Any.MetaValue("USER", typeof(User))]
> >    [Any.MetaValue("TEAM", typeof(Team))]
> >    public IProjectBidder Bidder { get; set; }
> > }
--~--~---------~--~----~------------~-------~--~----~
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