Cyclic reference is probably due to a flaw in design.
So what? We are not perfect
But we use Xaf, a model driven Application Framework from Devexpress and we can take advantage of that architecture so to overcome cyclic reference problems.
I think an example is the most appropriate here.
eXpand has a module called AdditionalViewControlsProvider , it can provide as the name says controls to views by setting some values on the model
and since its an eXpand module it references eXpand.ExpressApp assembly (core)
after I release AdditionalViewControlsProvider I release also PropertyPathFilters which is using AdditionalViewControlsProvider module to display the extra criteria
but is hosted at eXpand.ExpressApp assembly (core) !!!
How in the heck did I do that?
Simple I knew that AdditionalViewControlsProvider is sawing controls only if message is set to something, so even if core did not have a reference to AdditionalViewControlsProvider I could set that attribute to the value i wanted like
DictionaryNode dictionaryNode = wrapper.Node.FindChildNode("AdditionalViewControls");
dictionaryNode.SetAttribute("Message",text);
and when I reference both eXpand.ExpressApp assembly (core) and AdditionalViewControlsProvider everything will work as expected.
And even if I try to use propertypathfilters without AdditionalViewControlsProvider I could easily throw a warning like
ClassInfoNodeWrapper wrapper = GetClassInfoNodeWrapper();
DictionaryNode node = wrapper.Node.FindChildNode("AdditionalViewControls");
if (node== null){
throw new UserFriendlyException(new Exception("AdditionalViewControlsProvider module not found"));
}
}





