views:

48

answers:

1

Has anyone tried using ASP.NET MVC's WebForms view engine to do code generaiton? I know it's a vague question, but I was thinking it would be nifty if I could do something like this from the command line:

asp-net-mvc-codegen.exe entity?tablename=customer >> Customer.cs

Which would in turn start up Cassini, GET the URL in question and stick the output into Customer.cs.

Is that possible? Feasible? Have people been exploring this sort of thing yet? I guess the main thrust is that I would love to use the Web Forms templating engine to obviate the need for a third party code templating tool since the syntax is nearly identical to CodeSmith.

+1  A: 

I don't see any reason why it can't work. Though I dread the idea of writing code that has to escape <, >, and &.

Alternatively, switch your templates to T4 and take advantage of Visual Studio's built-in engine.

Frank Krueger