Not with TDL (the template language our templates are mainly written in). We also support C#/VB.NET style templates though (similar to codesmith/mygeneration templates), with <% code%> style syntaxis. These are called .lpt templates (their extension is .lpt)
You can mix them in a single template set, and even use .lpt templates as include templates inside TDL templates. The TDL language is limited but it's mainly a DSL to write templates quickly with a fixed set of keywords which can be replaced by data. So if you want to do things other than what TDL provides, it can't do it, but it otherwise offers a fast way to write template code as it is easy to avoid bugs in the template code because all statements represent actually pieces of code you otherwise had to write in the template itself.
.lpt templates can access the complete object model which is the llblgen project and you can write the template code itself in vb.net or C# and emit any output you want. So in .lpt templates you can write a template which generates your generic class based on the # of resultsets of a stored proc call.
As .lpt templates work on the object model of the project, you need the SDK + reference manual in the SDK which describes the object model you are consuming in the .lpt template. The template system works with template binding files, which bind a template file to a templateID, the tasks run at generation time have a templateID specified for the template they need to use. They then look up the template file via the templatebindings used (which depends on language chosen, db type etc.) and then execute the template.
So to achieve what you want, you could: (example for Adapter, Sqlserver, .net 2.0) (see also: Using the generated code -> Adding your own code to the generated classes -> Include templates) Haven't tested this, but gives you the idea:
- create a .lpt file, e.g. myRetrievalProcsInclude.lpt
- add a line to Templates\SD.TemplateBindings.SqlServerSpecific.NET20.templatebindings, C# section:
<templateBinding templateID="Custom_RetrievalProceduresAdapterTemplate" filename="SqlServerSpecific\Net2.x\C#\myRetrievalProcsInclude.lpt" />
(we normally recommend to create a new templatebindings file for that template alone or your own custom templates, but this will do for now. Our templatestudio editor makes this really easy)
- to myRetrievalProcsInclude.lpt, which you've saved in Templates\SqlServerSpecific\Net2.x\C#\, add:
<%
SPCallContainer retrievalProcCalls = _executingGenerator.ProjectDefinition.RetrievalSPCalls;
foreach(SPCallDefinition retrievalProc in retrievalProcCalls)
{
SPCallParameterCollection parameters = retrievalProc.Parameters;
if(retrievalProc.AmountResultsets > 1)
{
// Dataset
%> public T <%=retrievalProc.Name%><T>(<%...foreach over parameters %>) where T : DataSet, new()
{
// your proc code
}<%
}
else
{
// datatable
}
}%>
As you don't have the SDK nor template studio, you could check the object model with reflector (check SD.LLBLGen.Pro.ApplicationCore assembly, it's not obfuscated, and then the class 'Project' and the classes in the StoredProcedures namespace. The namespace is already added to the template so you can specify the classes as I did above.