Click here to Skip to main content
12,817,112 members (34,742 online)
Click here to Skip to main content


42 bookmarked
Posted 3 Aug 2008

Document and Code Generation by LINQ and XSL

, 3 Aug 2008 CPOL
An article on how to generate source code as well as populate Excel Spreadsheets.
Public Module LinqData_Final

	Public Function CreateClass_Final(ByVal table As DataTable) As XElement

		Dim xslt = <class_1>
namespace WebbertSolutions
	public class <%= From t In table.TableName Select t %>
		#region Constants


		#region Data Members
						   <%= From r In table.Rows _
							   Select <data_2a>
		private <fieldtype><%= r(1) %></fieldtype><%= " " %><fieldname><%= r(0) %></fieldname>;</data_2a> %>


		#region Constructor
		/// <summary>
		/// Constructor
		/// </summary>
		public <%= From t In table.TableName Select t %>()

		#region Properties
					   <%= From r In table.Rows _
						   Select <data_6>
									  <data_6a><fieldtype><%= r(1) %></fieldtype><fieldname><%= r(0) %></fieldname></data_6a>
								  </data_6> %>
		#region Methods - Public


		#region Methods - Private

		Return xslt

	End Function

End Module

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.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Dave Elliott
Software Developer (Senior) Webbert Solutions
United States United States
Dave is an independent consultant working in a variety of industries utilizing Microsoft .NET technologies.

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170308.1 | Last Updated 3 Aug 2008
Article Copyright 2008 by Dave Elliott
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid