views:

66

answers:

0

I've got a very simple data structure. I'm using SQLExpress with Linq2SQL and vb.net

**ParentClass**
parentId
name


**ChildClass**
childId
name
parentId  (foreign key to parent table)

The dbml reflects these two classes, and has a oneToMany association.

So far, so good.

In my code, i'm trying to get the value as follows

Dim count as Integer = Parent.ChildClasses.Count

(the answer is 10, btw). It works at first. I add five Child records. The count should now be 15, but its still reading 10. If i rebuild the solution and rerun the application, it correctly shows 15 - at least until i start adding more records.

I'm pretty sure this is a pretty n00bish mistake I'm making somewhere. Is it a function of lazy loading or am I barking up the wrong tree?