Hi,
I have class placed on the data layer, and it is initially instantiated with basic information.
It exposes a sub object called ExternalSourceData (or a method called Enrich), that calls an external source (consumes time) and instantiates some more data members inside the same object.
Clarification: I haven't used inheritance since this object is exposed to an external project, that uses it as an external assembly. Moreover, I want to clearly differ between the "regular" data members and the "external data source" members.
Thus, that's what I came up with:
List list = new List();
ExposedClass a = new ExposedClass(list);
int size = a.size;
string name = a.name;
.
.
if (LoadFromExternal)
a.ExternalSourcedData = new ExternalSourceData(externalSourceSessionParms)
and the usage will be:
if (a.ExternalSourcedData != null){
Guid id = a.ExternalSourcedData.ID;
.
.
.
}
I want the ExternalSourcedData ctor to use the list passed to a (it also passes over the elements of the list). unfortunately, from what i gather, there's no way to do it on c# (on c++ it would be called "Friend" and in java it could have been solved by using an inner class).
Is anyone familiar with a solution to that problem ? Maybe a design pattern that would make it more acceptable as i don't want to pass the list again to the ExternalSourceData ctor?
Thanks allot.