I've got several classes defined like so:
public interface IRecentSpaceItem
{
[PrimaryKey]
int Id { get; set; }
DateTime LastUpdated{ get; }
}
[ActiveRecord]
public class WhiteBoard : ModelBase<WhiteBoard>, IRecentUpdated
[ActiveRecord]
public class Discussion: ModelBase<Discussion>, IRecentUpdated
And then a "parent" class with something like this:
private IList<IRecentUpdated> _recentItems;
public IList<IRecentUpdated> RecentItems
{
get
{
if(_recentItems==null){_recentItems=new List<IRecentUpdated>
();}
return _recentItems;
}
set
{
if(value.Count>5)
{
_recentItems = new List<IRecentUpdated>(value.OrderBy(v =>
v.LastUpdated).Take(5));
return;
}
_recentItems = new List<IRecentUpdated>(value.OrderBy(v =>
v.LastUpdated));
}
}
So every time one of those items is added to the parent, it's also
added to RecentItems, so I can easily retrieve a list of the 5 most
recent things that happened to the parent class.
But I can't figure out how to map this to the database. I've looked
at
http://www.castleproject.org/activerecord/documentation/trunk/usersguide/typehierarchy.html,
but it looks like those require changes to the [ActiveRecord] tag on
the parent class which isn't supported on an interface.
Can anyone point me in the right direction? Am I going about this all
wrong?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---