Visual Studio Development Bookmark and Share   
 index > Visual Studio Guidance Automation Toolkit > Delete Extra Lines from Code using TextTemplateAction
 

Delete Extra Lines from Code using TextTemplateAction

Hello everyone,

I have the following template.

Code Block

#Region "Methods"

<# foreach(Field lField in CurrentEntity.Fields) { #>

Public Overridable Function <#= lField.Name #>() As ValidationCheckCol Implements I<#= CurrentEntity.CodeName #>Validator.<#= lField.Name #>

Dim lReturn As New ValidationCheckCol

<# if (!lField.Nullable) {#>

lReturn.Add(ValidationFactory.NullValidation("<#= lField.DisplayName #>", Entity, "<#= lField.Name #>"))

<# } #>

<# if (lField.ConstrainLength) {#>

lReturn.Add(ValidationFactory.LengthValidation("<#= lField.DisplayName #>", Entity, "<#= lField.Name #>", <#= lField.Length #>))

<# } #>

<# if (lField.RefData.Name.Length > 0) {#>

lReturn.Add(ValidationFactory.LookupValidation("<#= lField.DisplayName #>", Entity, "<#= lField.Name #>", <#= lField.RefData.Name #>, "<#= lField.RefData.ValueProperty #>"))

<# } #>

<# if (lField.Name == "BeginEffectiveDate" ) {#>

lReturn.Add(ValidationFactory.DateComparisonValidation("Begin Effective Date", Entity, "BeginEffectiveDate", "EndEffectiveDate", "Value of {0} is more than the End Effective Date {1}"))

<# } #>

<# if (lField.Name == "EndEffectiveDate" ) {#>

lReturn.Add(ValidationFactory.DateComparisonValidation("End Effective Date", Entity, "BeginEffectiveDate", "EndEffectiveDate", "Value of {1} is less than the Begin Effective Date {0}"))

<# } #>

<# if (lField.Type == "DateTime" ) {#>

lReturn.Add(ValidationFactory.DateRangeValidation("<#= lField.DisplayName #>", Entity, "<#= lField.Name #>"))

<# } #>

Return lReturn

End Function

<# } #>

#End Region

After I run it, then it comes up with so many empty while lines.What can I do to fix it?

output from that Template...

Code Block

Public Overridable Function LastUpdatedOnDatetime() As ValidationCheckCol Implements IKDOTJurisdictionValidator.LastUpdatedOnDatetime

Dim lReturn As New ValidationCheckCol

lReturn.Add(ValidationFactory.NullValidation("LastUpdatedOnDatetime", Entity, "LastUpdatedOnDatetime"))

' 5 extra lines

lReturn.Add(ValidationFactory.DateRangeValidation("LastUpdatedOnDatetime", Entity, "LastUpdatedOnDatetime"))

Return lReturn

End Function

Sy _  Friday, October 05, 2007 11:14 PM
Jose Escrich  Monday, October 08, 2007 9:56 PM
Jose Escrich  Monday, October 08, 2007 9:56 PM

You can use google to search for other answers

Custom Search

More Threads

• Install of February 2008 GAX Fails
• Getting the project object after Add New Project?
• Using IAssetReferenceService
• Nested Solution Folder Parent?
• Guidance Package Manager is disabled under Tools menu
• error installing gaxp1409.exe
• Installing GAT, GAX, Microsoft Recipe Framework and MCSF
• Customizing a wizard
• How can you use T3 templates in VS templates???
• Installing GAT on Vista with Orcas Beta1