G
Guest
In C#, how would people implement a relationship between Customer class and
Request class, considering a customer may have 0-n requests and a request
must belong to 1 and only 1 customer...?
Would about the following options?
OPTION 1
--------------------------
public class Customer()
{ private int CustomerID;
private string CustomerName;
}
public class Request()
{ private int IdRequest;
private datetime OrderDate;
private Customer Customer; ---Notice here I reference Customer class
}
OPTION 2
--------------------------
public class Customer()
{ private int CustomerID;
private string CustomerName;
private Request Request; ---Notice here I reference Request class
}
public class Request()
{ private int IdRequest;
private datetime OrderDate;
}
Besides, both ways above dont allow me to work with a list of requests
related to a customer, right?
Could someone give me some light on it? Im kind of lost...
Tanks
Request class, considering a customer may have 0-n requests and a request
must belong to 1 and only 1 customer...?
Would about the following options?
OPTION 1
--------------------------
public class Customer()
{ private int CustomerID;
private string CustomerName;
}
public class Request()
{ private int IdRequest;
private datetime OrderDate;
private Customer Customer; ---Notice here I reference Customer class
}
OPTION 2
--------------------------
public class Customer()
{ private int CustomerID;
private string CustomerName;
private Request Request; ---Notice here I reference Request class
}
public class Request()
{ private int IdRequest;
private datetime OrderDate;
}
Besides, both ways above dont allow me to work with a list of requests
related to a customer, right?
Could someone give me some light on it? Im kind of lost...
Tanks