Login

Username

Password





Register   Reset password

This is a read-only archive of the forum.

# gedw99 8/6/2007 6:34 AM (edited 8/6/2007 6:40 AM)
I just noticed this in the new code in the trunk:

Cuyahoga.Core.Decorators. AbstractDaoDecorator : IContentItemDao: IContentItem

I was wondering if the the decorator pattern will be used for templates and Sections output, and not just the lower DAO stuff.
This would allow asp.net and html to be decorated in the same way as css decorates html.
The reason i suggest this as when using Cuyahoga you often have to implement a new Module just because the output from user control of the module if different. What I really want is to be ale to just decorate the out out in a loose fashion.

This in effect becomes very similar to what Portlets do, but without all the mind numbing and breakable config issues.

You would use the exact injection points that Cuyahoga uses; Templates and Sections. At the template level you could apply a decorator to all modules of type X. At ther section level you could apply a specific decorator.

You could then have Decorator service, that can retrieve them from the file system and a Decorator worker that would apply them. This would allow you to write decorations in c# using StringTemplate or use a base XSLTDecorator and call a file n the file system to do it.

Ultimately it would allow the semantic structure from Modules output to be modified on a case by case basis an achieve what css templating cant do.


ged



# mgaerber 8/6/2007 9:52 PM
I guess this would be possible by adding decorators for the System.Web.UI.UserControl class, so you could provide your custom "Render" method.

However, the controls are currently not managed by the IoC container (and probably better won't). I'm not aware of alternatives but there should be better solutions to achieve this sort of "output customization".

The cleanest solution would be MVC, where you can provide alternative views. With ASP.NET, Model View Presenter could be an option for user controls - maybe worth a look...



# gedw99 8/9/2007 2:13 AM
thansl Max,

will have a think but not quite sure exactly what you mean about using MVC.

All i am trying to do is NOT have to create a new module, just because i want to have a different UI.

I guess by MVC you are talking about separating the layers properly. Indeed i agree.
Hence, maybe what i should be doing is to split a single module into 2; just having a Module for Data and a Module for Presentation.
Then many presentation modules can use a singel data module for example.

I know others have resorted to XSLT and i cant stand XSLT - drives me bonkers :)

G
# mgaerber 8/9/2007 7:46 PM
gedw99I guess by MVC you are talking about separating the layers properly

Exact. ln the end it's matter of how module developers prepare their module for extensibility. For ASP.NET, MVP (see http://msdn.microsoft.com/msdnmag/issues/06/08/DesignPatterns/default.aspx ) would be the better option, I guess.

This would mean that the current UserControls would have to implement an interface, e.g. IArticleDetailView and provide a "Presenter" that is responsible for the UI logic (e.g. filling the IArticleDetailView.ArticleTitle property etc.)

This way, you can switch the views more easily, preserving all UI logic.

Regards,

Max