Click here to Skip to main content
15,499,046 members
Articles / Web Development / HTML
Posted 22 Oct 2014


29 bookmarked

Generate SPA Web App Instantly in Minutes

Rate me:
Please Sign up or sign in to vote.
5.00/5 (9 votes)
22 Oct 2014CPOL3 min read
Generate a web app instantly, directly from a database(SQL Server)


This tool generates data driven ASP.NET MVC - SPA applications in seconds. An invaluable tool for redeveloping and fast tracking conversion of old legacy applications written in Access, spreadsheets, and other obsolete software.

The generated SPA web app has been fully tested and quality assured, and all code can be customized from within Visual Studio 2012 or 2013 (including Express versions).

The resultant web app will fit and resize on all devices, including mobile phones.

The Visual Studio solution can be regenerated from this tool anytime, as all the database definitions and solutions are stored for each user.
An important feature of this tool is that you can generate a solution in either ASPX or Razor, and Entity Framework or ADO, or any combination of these.

It is a FREE tool that has no proprietary DLLs or libraries, and you are not locked into a proprietary IDE.

Please see the Readme file, for installing the demo correctly.

How the Tool Generates a Web App

The required database tables and columns for the resultant web app are stored in a database behind the scenes.
Please see diagram below. (Main tables are VSOLUTION, ENTITYTABLE & ENTITYCOLUMN.)

There can also be many solutions stored as well, from which a Visual Studio solution is created.
When you click on the Generate Code button in the Tool, logic reads the database tables associated with the solution required, and automatically changes the included templates, to produce all the code.

Sample Image - maximum width is 600 pixels

The most important screen in the Tool is the web app database schema Entry, which is shown in the diagram below:

Sample Image - maximum width is 600 pixels

After the schema has been entered for your web app, as shown above, the actual Visual Studio solution is created by just clicking on the Generate Code button, on the screen shown below:

Sample Image - maximum width is 600 pixels

The Templates used to create the solution are stored in a folder (Gen_Code), which are encrypted.
They are unencrypted, subsequent copies are made, then changed, on the fly.
The final solution which contains 3 Projects (i.e., appMODEL, appBLL & AHIM) is then zipped, ready for download.

Generating Code

public void MakeTOPGRID(long SECTID, string strapsxrazor, string projstr, string stradoefcombo)
   bool returnStatus;
   string returnErrorMessage;
   List<string> returnMessage = new List<string>();

   StringBuilder sqlBuilder = new StringBuilder();
   string sqlString = "";

   sqlString = sqlString + "WITH CTE AS ( ";
                                              PROP_NOTE, PARENT_SECTOR_ID, ";
   sqlString = sqlString + "FROM ViewPHYSECTPROP WHERE SECTOR_ID = @SECTID ";
   sqlString = sqlString + "UNION ALL ";
                         ViewPHYSECTPROP.PHY_ID, ViewPHYSECTPROP.PROP_NAME, ";
   sqlString = sqlString + "ViewPHYSECTPROP.PROP_TYPE, 
                         ViewPHYSECTPROP.DB_SERVER_NAME, ViewPHYSECTPROP.DB_NAME, ";
   sqlString = sqlString + "ViewPHYSECTPROP.PHY_PAGE_TYPE, 
                           ViewPHYSECTPROP.PHY_DB_TYPE, ViewPHYSECTPROP.PHY_VS_TYPE ";
   sqlString = sqlString + "FROM CTE ";
   sqlString = sqlString + "INNER JOIN ViewPHYSECTPROP ON ViewPHYSECTPROP.Parent_SECTOR_ID =
   sqlString = sqlString + " ) ";
   sqlString = sqlString + "SELECT distinct * FROM CTE ";

   UtilitiesBLL UtilitiesBLLget = new UtilitiesBLL();
   SqlConnection connection = UtilitiesBLLget.CreateConnectionRMSPROD(out returnStatus, out returnErrorMessage); 
   SqlCommand myCommand = new SqlCommand();
   myCommand.CommandType = CommandType.Text;
   myCommand.Connection = connection;
   myCommand.CommandText = sqlString;

   SqlParameter param12 = new SqlParameter("@SECTID", SqlDbType.BigInt);
   param12.Value = SECTID;


   SqlDataReader dataReader = myCommand.ExecuteReader();
   while (dataReader.Read() == true)
      script.PHY_ID = dataReader["PHY_ID"] != DBNull.Value ? 
          Convert.ToInt64(dataReader["PHY_ID"]) : 0;
      script.sectortype = dataReader["SECTOR_TYPE"] != DBNull.Value ? 
          dataReader["SECTOR_TYPE"].ToString() : "";
      if (script.sectortype == "TOPGRID")
        script.SECTOR_ID = dataReader["SECTOR_ID"] != DBNull.Value ? 
            Convert.ToInt64(dataReader["SECTOR_ID"]) : 0;

       script.tablename = dataReader["SECTOR_NAME"] != DBNull.Value ? 
           dataReader["SECTOR_NAME"].ToString() : "";
       progstr = script.tablename;
       script.propnote = dataReader["PROP_NOTE"] != DBNull.Value ? 
           dataReader["PROP_NOTE"].ToString() : "";
       if (script.propnote == "PK")
         script.primarykey = dataReader["PROP_NAME"] != DBNull.Value ? 
             dataReader["PROP_NAME"].ToString() : "";
         strpkid = script.primarykey;
       if (script.propnote == "column1")
        script.column1 = dataReader["PROP_NAME"] != DBNull.Value ? 
            dataReader["PROP_NAME"].ToString() : "";
        column1str = script.column1;
        script.column1type = dataReader["PROP_TYPE"] != DBNull.Value ? 
            dataReader["PROP_TYPE"].ToString() : "";
        column1type = script.column1type;
        if (script.propnote == "column2")
         script.column2 = dataReader["PROP_NAME"] != DBNull.Value ? 
             dataReader["PROP_NAME"].ToString() : "";
         column2str = script.column2;
         script.column2type = dataReader["PROP_TYPE"] != DBNull.Value ? 
             dataReader["PROP_TYPE"].ToString() : "";
         column2type = script.column2type;
        if (script.propnote == "column3")
          script.column3 = dataReader["PROP_NAME"] != DBNull.Value ? 
              dataReader["PROP_NAME"].ToString() : "";
          column3str = script.column3;
          script.column3type = dataReader["PROP_TYPE"] != DBNull.Value ? 
              dataReader["PROP_TYPE"].ToString() : "";
          column3type = script.column3type;
         if (script.propnote == "column4")
         script.column4 = dataReader["PROP_NAME"] != DBNull.Value ? 
             dataReader["PROP_NAME"].ToString() : "";
         column4str = script.column4;
         script.column4type = dataReader["PROP_TYPE"] != DBNull.Value ? 
             dataReader["PROP_TYPE"].ToString() : "";
         column4type = script.column4type;
   string newViewFolder = "~/Gen_Code/" + projstr + "/AHIM/Views/" + progstr;
   new Microsoft.VisualBasic.Devices.Computer().FileSystem.CreateDirectory

   if (strapsxrazor == "ASPX")
      GenerateTOPGRID(projstr, progstr, strpkid, column1str, column1type, column2str, column2type, 
                                 column3str, column3type, 
                                 column4str, column4type, childprog1str, childprog2str, 
                                 strcomboclicked, comboprogstr, stradoefcombo);
   else  //Razor pages instead
      GenerateTOPGRIDRAZ(projstr, progstr, strpkid, column1str, 
                      column1type, column2str, column2type, 
                                column3str, column3type, column4str, 
                                column4type, childprog1str, childprog2str, 
                                strcomboclicked, comboprogstr, stradoefcombo);
catch (Exception ex)

Demo Videos

Below are demo YouTube videos showing the main features of this Generator in action.

Points of Interest

All the source code provided will actually have the Generator working fully. I have also included the stored database definition.

The whole tool is downloadable, and can be opened in Visual Studio 2012 or 2013.

This article is linked to my other article (Web App Builder - Single Page Application(SPA) on any Mobile Device).

I have spent over 3 years developing this tool, and I have used it in developing a major permits application, for an Australian Government Department.

I have progressed it to a version that is proven and documented, for ease of customization in Visual Studio.

This tool is in direct competition with other products such as Ironspeed, Codeontime and others.

The major differences are:

  1. Creates ASP.NET MVC C# code
  2. Not locked into a proprietary IDE
  3. Not dependent on proprietary DLLs and libraries
  4. Generated web app, easily modified in Visual Studio or other .NET IDEs (eg SharpDevelop)
  5. Developed by a highly qualified and experienced programmer, and tested 100% on all major browsers
  6. And of course is an Open Source product


  • 22nd October, 2014: Initial version


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

Comments and Discussions

QuestionCant Connect to SQL Server 2014 Pin
CodingMachine6-Nov-14 16:58
MemberCodingMachine6-Nov-14 16:58 
AnswerRe: Cant Connect to SQL Server 2014 Pin
Kalvin Lawrence Ernst6-Nov-14 17:23
professionalKalvin Lawrence Ernst6-Nov-14 17:23 
GeneralRe: Cant Connect to SQL Server 2014 Pin
CodingMachine6-Nov-14 17:53
MemberCodingMachine6-Nov-14 17:53 
GeneralRe: Cant Connect to SQL Server 2014 Pin
Kalvin Lawrence Ernst6-Nov-14 18:27
professionalKalvin Lawrence Ernst6-Nov-14 18:27 
GeneralRe: Cant Connect to SQL Server 2014 Pin
Kalvin Lawrence Ernst6-Nov-14 18:29
professionalKalvin Lawrence Ernst6-Nov-14 18:29 
GeneralRe: Cant Connect to SQL Server 2014 Pin
CodingMachine6-Nov-14 18:11
MemberCodingMachine6-Nov-14 18:11 
GeneralRe: Cant Connect to SQL Server 2014 Pin
Kalvin Lawrence Ernst6-Nov-14 18:28
professionalKalvin Lawrence Ernst6-Nov-14 18:28 
QuestionReferences error Pin
Laurentiu LAZAR28-Oct-14 3:43
MemberLaurentiu LAZAR28-Oct-14 3:43 
AnswerRe: References error Pin
Kalvin Lawrence Ernst28-Oct-14 12:52
professionalKalvin Lawrence Ernst28-Oct-14 12:52 
GeneralMy vote of 5 Pin
E. Scott McFadden24-Oct-14 10:20
professionalE. Scott McFadden24-Oct-14 10:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.