开发者

Custom Collection extends List<T> Add method

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 m开发者_运维技巧ethods 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?


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.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜