private static void InsertConstructors(ProcessTemplate template, TypeDeclaration t)
{
// foreach constructor create a method
List <ConstructorDeclaration>constructors = CSParser.GetConstructors(t);
if (constructors.Count == 0)
{
// will cause compile error if the constructor is missing, because it is not implementing the interface completely
throw new Exception("missing a connector constructor in " + t.Name + "; details: " + t.ToString());
}
// find constructor and copy the parameters
foreach (ConstructorDeclaration m in constructors)
{
ProcessTemplate methodSnippet = ClientRemotingClassTemplate.GetSnippet("METHOD");
methodSnippet.SetCodelet("METHODNAME", t.Name.Substring(1, t.Name.Length - 1 - "UIConnector".Length));
methodSnippet.SetCodelet("RETURNTYPE", CSParser.GetImplementedInterface(t));
string ParameterDefinition = string.Empty;
string ActualParameters = string.Empty;
AutoGenerationTools.FormatParameters(m.Parameters, out ActualParameters, out ParameterDefinition);
methodSnippet.SetCodelet("PARAMETERDEFINITION", ParameterDefinition);
methodSnippet.SetCodelet("ACTUALPARAMETERS", ActualParameters);
methodSnippet.SetCodelet("RETURN", "return ");
template.InsertSnippet("METHODSANDPROPERTIES", methodSnippet);
}
}