Circular References

Putting the finishing touches on GenX.NET 3.0, and I have stumbled across a disturbing problem. I KNOW that the architecture is not good enough yet. I want to be able to have the data transformation engine completely separate from the data transformation formats, which I have done already. There is a huge problem tho. I hope I can explain it adequately.

I'm using a factory pattern to manage the standard OutputProviders. The factory obviously has to know which providers map where. Well, my engine has 2 classes, FromDataReader and FromDataSet. I think you can probably guess as to their purpose. They inherit from a base class called Globals, which has the base properties and methods that are common to each engine class. Each derived class extends the base class with new properties, specific to each class.

Well, because the base is extended, I have to pass a reference to the derived class to the OutputProvider as the only parameter, so that it can access the properties set by the user at runtime. I will have no control over how the end user inherits that class if they decide to extend it further, so I cant tie down the Providers by having specific method parameters.

if I try to move these OutputProviders to another assembly, I still have to reference the main engine assembly to get the reference type for the derived classes, and I have to reference the other assembly to have the Factory know which providers are there, creating, you guessed it, a circular reference.

Now, I know I can load the assembly dynamically, but that is not worth it for this release. I know that what I have works, as it's already been thoroughly tested. I'm just letting my relentless pursuit of coding excellence get the better of me.

I already have a method for passing in outside OutputProviders, but it completely negates the Factory, and I won't be able to transform the data in only 3 lines of code if I stick solely to that method... which is the standard for my competitors. Ugh.

No Comments