Click here to Skip to main content
15,885,546 members
Articles / Web Development / ASP.NET

Three Tier Code Generator For ASP.NET

Rate me:
Please Sign up or sign in to vote.
4.78/5 (34 votes)
8 Jul 200512 min read 425.3K   22.2K   251  
Generates three tier code for ASP.NET.
<%

Function ConstructorStart(AccessMod, ConstructorName, ParametersCol, CodeLanguage, Tab)
	AccessMod = GetAccessModifier(AccessMod, "0", CodeLanguage)
	Select Case CodeLanguage
		Case "0" 			
			ConstructorStart = Tab & AccessMod & " Sub New(" & ParametersCol & ")"  & vbCrLf
		Case "1" 
			ConstructorStart = Tab & AccessMod & " " & " " & ConstructorName & "(" & ParametersCol & ")" & vbCrLf
	End Select
End function

Function FunctionStart(AccessMod, FunctionName, ParametersCol, ReturnType, CodeLanguage, Tab)
	AccessMod = GetAccessModifier(AccessMod, "0", CodeLanguage)
	Select Case CodeLanguage
		Case "0" 			
			FunctionStart = Tab & AccessMod & GetFuncTitle(ReturnType) & FunctionName & "(" & ParametersCol & ")" & GetReturnType(ReturnType)
		Case "1" 
			FunctionStart = Tab & AccessMod & " " & ReturnType & " " & FunctionName & "(" & ParametersCol & ")" 
	End Select
End function

Function GetFuncTitle(ReturnType)
	If ReturnType = "void" Then
		GetFuncTitle = " Sub "
	Else
		GetFuncTitle = " Function "
	End if
End Function

Function GetReturnType(ReturnType)
	If ReturnType = "void" Then
		GetReturnType = ""
	Else
		GetReturnType = " As " & ReturnType
	End if
End Function

Function GetReturn(ReturnValue, CodeLanguage)	
	Select Case CodeLanguage
		Case "0" 			
			GetReturn = "Return " & ReturnValue
		Case "1" 
			GetReturn = "return " & ReturnValue
	End Select
End function

Function FunctionEnd(FuncType, CodeLanguage, Tab)	
	Select Case CodeLanguage
		Case "0" 
			Select Case FuncType
				Case "0" 			
					FunctionEnd = Tab & "End Sub" & vbCrLf
				Case "1" 
					FunctionEnd = Tab & "End Function" & vbCrLf  
			End Select			
		Case "1" 
			FunctionEnd = Tab & "}" & vbCrLf  
	End Select
End function


%>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Software Developer (Senior)
Australia Australia
Stevan is a Microsoft Certified Solutions Developer in .Net Architecture (MCSD.Net Early Achiever – one among the first 2500 worldwide), Microsoft Certified Application Developer in .Net – MCAD.Net (Charter Member - one among the first 5000 developers worldwide).

Comments and Discussions