实际的MOEDL应为2个,如
[ActiveRecord("company")]
public class Company : ActiveRecordBase
{
private int id;
private String name;
private IList _people;
public Company()
{
}
public Company(string name)
{
this.name = name;
}
[PrimaryKey]
public int Id
{
get { return id; }
set { id = value; }
}
[Property]
public String Name
{
get { return name; }
set { name = value; }
}
[HasAndBelongsToMany( typeof(Person),
Table="people_companies",
ColumnRef="person_id", ColumnKey="company_id" )]
public IList People
{
get { return _people; }
set { _people = value; }
}
}
[ActiveRecord("people")]
public class Person : ActiveRecordBase
{
private int _id;
private String _name;
private IList _companies;
public Person()
{
_companies = new ArrayList();
}
[PrimaryKey]
public int Id
{
get { return _id; }
set { _id = value; }
}
[Property]
public string Name
{
get { return _name; }
set { _name = value; }
}
[HasAndBelongsToMany( typeof(Company),
Table="people_companies",
ColumnRef="company_id", ColumnKey="person_id" )]
public IList Companies
{
get { return _companies; }
set { _companies = value; }
}
}