XML Literal Code Genaration – Code again again


 For now, I’m just removing the coloring. Paste this into VS for coloring. It’s much prettier:

   Private Function MemberDataPortalFetch() As String
      ‘ TODO: Add special handing for timestamp
      Return _
   Private Overloads Sub DataPortal_Fetch(ByVal criteria As Criteria)
      Using cn As New SqlConnection(<%= mObjectData.ConnectionStringName %>)
         Using cm As SqlCommand = cn.CreateCommand
            cm.CommandType = CommandType.StoredProcedure
            cm.CommandText = “get<%= mObjectData.ClassName %>”
            <%= From prop In mObjectData.PrimaryKeys Select _
            cm.Parameters.AddWithValue(“@<%= prop.Name %>”, criteria.<%= prop.Name %>)
               </code> %>

            Using dr As New SafeDataReader(cm.ExecuteReader)
               With dr
                  <%= From prop In mObjectData.Properties Select _
                  m<%= prop.Name %> = <%= GetReadMethod(prop) %>(“<%= prop.Name %>”)
               </code>.Value %>

                  ‘ load child objects
                  <%= From child In mObjectData.Children Select _
                  m<%= child.Name %> = <%= child.Name %> .Get<%= child.Name %> (dr)
                     </code>.Value %>
               End With
            End Using
         End Using
      End Using
   End Sub
   End Function

Leave a Reply

Your email address will not be published. Required fields are marked *