views:

206

answers:

1

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?

A: 

Your best bet is to set up and configure an ORM (Object-relational mapping), such as NHibernate, that will manage this for you. In effect, you set up the data model, and the ORM framework will take care of persisting that information for you.

Marcus Griep