I am about to design a new application in VS 2008 and had some questions regarding LINQ. Currently if I want my class to contain a collection of say, "Bike" objects, I would have to define a class called "Bikes" that inherits some kind of collection and then override the corresponding Add, Remove, etc methods in order to keep the data in my object model and backend database in sync.

For example (psuedocode):

VB Code:
  1. Public Class clsBike
  2.      Public Property WheelCount As Short
  3. End Class
  4.  
  5. Public Class clsBikes
  6.      Inherits Dictionary (of String, clsBike)
  7.  
  8.      'override the add method so that you can actually add the bike to the database
  9.  
  10. End Class
  11.  
  12. Public Class X
  13.      Public Property Bikes As clsBikes
  14. End Class

My question is, is there a way for an object model, in this case, class X, to work implicitly with the database? In other words, is there a way to make the property "Bikes" in class X just a Dictionary (of String, clsBike) and have it automatically update the database when the Add, Remove, etc methods are called, as opposed to having to create another class that inherits a collection and must use overriding?

This may not be possible, but I just wanted to see if it was...