0

I want to create a custom collection and add my own custom Add method. Scenario:

Teacher.Students.Add(Student s)

I want to put LINQ methods to save the teacher/student relationship to the database, not just add it to the list.

How can I do that? How can I know what "Teacher" object this is?

4

1 回答 1

0

您最好的选择是设置和配置一个 ORM(对象关系映射),例如NHibernate,它将为您管理这个。实际上,您设置了数据模型,ORM 框架将负责为您保存该信息。

于 2009-11-06T18:59:55.770 回答