Quantcast
Channel: Leaning Into Windows
Viewing all articles
Browse latest Browse all 30

XML Literal Code Generation - Code again

$
0
0

OK, that code listing got friend on load. Let me try again.

    PrivateFunction MemberDataPortalFetch() AsString      Return _<code>   Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)      Using cn As New SqlConnection(<%= mObjectData.ConnectionStringName %>)         cn.Open()         Using cm As SqlCommand = cn.CreateCommand            cm.CommandType = CommandType.StoredProcedure            cm.CommandText = "get<%= mObjectData.ClassName %>"            <%=From prop In mObjectData.PrimaryKeys Select _               <code>            cm.Parameters.AddWithValue("@<%= prop.Name %>", criteria.<%= prop.Name %>)               </code>%>             Using dr As New SafeDataReader(cm.ExecuteReader)               dr.Read()               With dr                  <%=From prop In mObjectData.Properties Select _                     <code>                  m<%= prop.Name %>= <%= GetReadMethod(prop) %>("<%= prop.Name %>")               </code>.Value %>                   ' load child objects                  .NextResult()                  <%=From child In mObjectData.Children Select _                     <code>                  m<%= child.Name %>= <%= child.Name %>.Get<%= child.Name %>(dr)                      </code>.Value %>               End With            End Using         End Using      End Using   End Sub</code>.Value   EndFunction

 


Viewing all articles
Browse latest Browse all 30

Trending Articles