views:

39

answers:

2

Hi, I'm having a ridiculous little problem.

I have generated my model classes in visual C# Express 2010 but in a 1(parent)->Many(children) relation I can only access the children through a vector in the parent. I want to also be able to access the parent through a child.

Does anyone know if this is a setting problem with a simple check the checkbox to fix, database design or is it just some random error?

A: 

well if you're talking about code sample. you may add the parent reference to a child.

class Parent{

 Child CreateChild()
 {
  return new Child(this);
 }
}
class Child
{
 Child(Parent parent){
  this.parent = parent;
 }
}
Arseny
Well, I'm accually talking about how to generate this in an "ADO.NET Entity Data Model" directly from the database. But thanks anyway :)
LimetreeValley
A: 

I think It was some kind of random error. When I deleted and regenerated my model it worked fine.

LimetreeValley