|
-
Feb 5th, 2009, 09:08 AM
#1
Thread Starter
Fanatic Member
[2008] LINQ, SQL and Object Models
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:
Public Class clsBike
Public Property WheelCount As Short
End Class
Public Class clsBikes
Inherits Dictionary (of String, clsBike)
'override the add method so that you can actually add the bike to the database
End Class
Public Class X
Public Property Bikes As clsBikes
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...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|