zulu wrote:
Hello,
I have created some lpt templates and they get generated fine but there are two things
which, even though they have no effect on the code itself, are frustrating:
- For code like the following:
<% If _executingGenerator.ProjectDefinition.TypedLists.Count > 0 Then %>
Imports <%= _executingGenerator.ProjectDefinition.RootNameSpace %>.TypedListClasses
<% End If %>
gets generated as an empty line in the generated file.
That's because of the CRLF after <% End If %>
please place that statement on a different line to see if that helps. Other than that, there's not much we can do as the text right after <% End If %> is not belonging to the if statement, including the CRLF.
- Code like the following:
<%= DotNetTemplateEngine.GetUserCodeRegion("InitializeDefaultSorter","'") %>
gets generated like this:
' __LLBLGENPRO_USER_CODE_REGION_START
' __LLBLGENPRO_USER_CODE_REGION_END
In other words, the indenting of the comment lines is not correct.
Is the original region placed at the start of the line? Please do so.
zulu wrote:
Another example:
<%
Dim pfIndexPower As Int16
If OneToManyRelations.Count > 0 OrElse ManyToOneRelations.Count > 0 Then
%>
<Flags()> _
Public Enum <%= EntityName %>PrefetchFlags
<%
For Each rel As EntityRelation In OneToManyRelations
pfIndexPower += 1 %>
<%= rel.UtilizingPropertyName %> = <%= 2^pfIndexPower %>
<%
Next
For Each rel As EntityRelation In ManyToOneRelations
pfIndexPower += 1 %>
<%= rel.UtilizingPropertyName %> = <%= 2^pfIndexPower %>
<%
Next
%>
End Enum
<%
End If
%>
Is generated as:
<Flags()> _
Public Enum DummyEntityPrefetchFlags
Value1 = 1
Value2 = 2
Value2 = 4
Value2 = 8
End Enum
Instead of
<Flags()> _
Public Enum DummyEntityPrefetchFlags
Value1 = 1
Value2 = 2
Value2 = 4
Value2 = 8
End Enum
Please try:
Dim pfIndexPower As Int16
If OneToManyRelations.Count > 0 OrElse ManyToOneRelations.Count > 0 Then
%>
<Flags()> _
Public Enum <%= EntityName %>PrefetchFlags<%
For Each rel As EntityRelation In OneToManyRelations
pfIndexPower += 1 %>
<%= rel.UtilizingPropertyName %> = <%= 2^pfIndexPower %><%
Next
For Each rel As EntityRelation In ManyToOneRelations
pfIndexPower += 1 %>
<%= rel.UtilizingPropertyName %> = <%= 2^pfIndexPower %><%
Next%>
End Enum
<%
End If
%>