Castle Activerecord. Two collections of the same class
I want to have two collections of same class items in Activerecord. How to map this?
class Project
{
[HasMany]
IList<Resource> Reso开发者_开发知识库urces { get; set; }
[HasMany]
IList<Resource> DepartmentResources { get; set; }
}
public class Resource
{
[BelongsTo ???
}
Use the ColumnKey property, e.g.:
[HasMany(ColumnKey="res")]
IList<Resource> Resources { get; set; }
[HasMany(ColumnKey="deptres")]
IList<Resource> DepartmentResources { get; set; }
...
public class Resource {
[BelongsTo("res")]
Project Project {get;set;}
[BelongsTo("deptres")]
Project DeptProject {get;set;}
}
精彩评论