开发者

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;}
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜