Macro in ASP.NET (part 2)

Published 22 February 04 12:32 AM | despos

Thanks for sharing your thoughts!

I've been thinking to ASP.NET macros for quite some time lately, but I'm not sure they are really a good idea. Read, something you might want to add to the official wish list for the next version of ASP.NET.

Maybe they are. Maybe not. However, I want to clarify a couple of points raised by some comments.

What I call an ASP.NET macro is the capability of expanding some compact code to HTML literal markup before the ASPX source page is compiled to the assembly. It goes without saying that this can be coded with a custom or a user control. I just don't want to use server controls. By design.

There's nothing a macro (according to the definition above) can do that a server control cannot do either. The rub lies in the fact that controls have a certain impact on performance and should be avoided when the functionality they provide isn't strictly necessary. 

Basically, I'm looking for the save programming style pushed by controls without the overhead of controls. I'd like to use a compact and declarative syntax to reference significant pieces of (literal) HTML. A way to save development time. Andrew hinted at ideas he has to improve design-time tools. This is certainly one way to give me the functionality that I devise in what I call ASP.NET macros.

I haven't found yet significant scenarios where this would really be useful. But in some way I feel this is something I need to think more about.  

Comments

# VGA said on February 21, 2004 06:49 PM:


>>> significant pieces of (literal) HTML

Why not just use an UserControl with OutputCache enabled? After it gets cached overhead should be non-existent.

# Ignacio Nicolás Rodríguez said on February 22, 2004 08:42 PM:

See how .NET technologies are all about wasting cycles and killing mosquito with bazookas?

# Michael Teper said on February 23, 2004 12:56 PM:

I havent tried lately, but I'm pretty sure server side includes still work in ASP.NET. Just throw your HTML in there and SSI it.

If you are looking to pass parameters to your "macros", then you really ARE looking for server controls, and whether or not the VS.NET IDE or even the ASP.NET infrastructure hide the implementation details for you, under the covers thats still is the most sensible technology to use, IMO.

Leave a Comment

(required) 
(required) 
(optional)
(required)