Consider a layered application where the DataLayer has a certain class with all the data access stuff in it, and above that the business layer has a class which can take in the constructor a data object, and has other overloads as well. Ex:
namespace Datalayer
{
public class dataObject
{
// all the class here
}
}
namespace BusinessLayer
{
public class busObject
{
busObject(){}
busObject(Datalayer.dataObject parm) {/*do something with parm*/}
busObject(int objectID) {/*go get the dataObject with the ID*/}
}
}
Layers above (a UI layer probably) should not need to have a reference to the datalayer in this model. However, with the ctors set up in the business layer in this way it is required. Can someone explain why?
I would prefer to have my ctors this way, but do not want that datalayer reference in the UI layer. To get around it to date I have removed that last ctor and added a method as such to set up the object after instantiation:
Select(int objectID) {/*go get the dataObject with the ID*/}
Is it possible in any way to leave my constructors as above without requiring that reference?
sheldon